Convert all image locations to be absolute. Issues #954 & 1280

This commit is contained in:
Maurice Parker 2019-11-09 17:37:25 -06:00
parent f687fc96a6
commit 8a69657b54
1 changed files with 9 additions and 0 deletions

View File

@ -14,6 +14,13 @@ function stripStyles() {
document.getElementsByTagName("body")[0].querySelectorAll("[style]").forEach(element => element.removeAttribute("style")); document.getElementsByTagName("body")[0].querySelectorAll("[style]").forEach(element => element.removeAttribute("style"));
} }
// Convert all image locations to be absolute
function convertImgSrc() {
document.querySelectorAll("img").forEach(element => {
element.src = new URL(element.src, document.baseURI).href;
});
}
function error() { function error() {
document.body.innerHTML = "error"; document.body.innerHTML = "error";
} }
@ -26,5 +33,7 @@ function render(data) {
wrapFrames() wrapFrames()
stripStyles() stripStyles()
convertImgSrc()
postRenderProcessing() postRenderProcessing()
} }