Merge pull request #196 from aurimasv/fixRelLink
Remove 'about:blank?' from all links
This commit is contained in:
commit
5586b409e9
1 changed files with 5 additions and 3 deletions
|
@ -496,7 +496,7 @@ var wpdDOMSaver = {
|
||||||
// currentURL to the URL of the frame document and afterwards back to the baseURL
|
// currentURL to the URL of the frame document and afterwards back to the baseURL
|
||||||
if (this.frameNumber < this.frameList.length) {
|
if (this.frameNumber < this.frameList.length) {
|
||||||
var newFileName = this.saveDocumentEx(this.frameList[this.frameNumber++].document, this.name + "_" + this.frameNumber);
|
var newFileName = this.saveDocumentEx(this.frameList[this.frameNumber++].document, this.name + "_" + this.frameNumber);
|
||||||
aNode.setAttribute("src", newFileName);
|
aNode.setAttribute("src", this.relativeLinkFix(newFileName));
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
wpdCommon.addError("[wpdCommon.processDOMNode]:\n -> aNode.nodeName: " + aNode.nodeName + "\n -> " + ex);
|
wpdCommon.addError("[wpdCommon.processDOMNode]:\n -> aNode.nodeName: " + aNode.nodeName + "\n -> " + ex);
|
||||||
|
@ -574,7 +574,9 @@ var wpdDOMSaver = {
|
||||||
return aHTMLText;
|
return aHTMLText;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// While we're replacing references with local file paths,
|
||||||
|
// we don't want to have the browser try and fetch them
|
||||||
|
// We prefix them with 'about:blank?' and remove later via repairRelativeLinks
|
||||||
relativeLinkFix: function (aFileName) {
|
relativeLinkFix: function (aFileName) {
|
||||||
return "about:blank?" + aFileName;
|
return "about:blank?" + aFileName;
|
||||||
},
|
},
|
||||||
|
@ -584,7 +586,7 @@ var wpdDOMSaver = {
|
||||||
// that sending an invalid request to the server when the img src
|
// that sending an invalid request to the server when the img src
|
||||||
// is a relative link to a file in a different directory
|
// is a relative link to a file in a different directory
|
||||||
repairRelativeLinks: function (aHTMLText) {
|
repairRelativeLinks: function (aHTMLText) {
|
||||||
return aHTMLText.replace(/(src)="about:blank\?([^"]*)"/g, '$1="$2"');
|
return aHTMLText.replace(/(src|background|data|href)="about:blank\?([^"]*)"/g, '$1="$2"');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue