retargetAllHrefs static method
Changes the target of all anchor href elements in htmlDoc
.
- Default
target
is '_blank' (new tab) - Valid values for
target
are- '_blank'
- '_self'
- '_parent'
- '_top'
- or framename
Implementation
static retargetAllHrefs(HtmlDocument htmlDoc, [String target = '_blank']) {
log.info('Function : retargetAllHrefs, '
'Parameters : {[htmlDoc,$htmlDoc][target,$target]}');
htmlDoc.querySelectorAll('a').forEach((Element e) {
log.finest(
'Function : retargetAllHrefs, old : ${e.attributes['target']}');
e.attributes['target'] = target;
log.finest(
'Function : retargetAllHrefs, new : ${e.attributes['target']}');
});
log.fine('Function : retargetAllHrefs, Return : void');
}