adjusted cors

This commit is contained in:
nedim hadzialic 2021-04-30 17:25:33 +02:00
parent 7222aba1b4
commit 42e2d906ef
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"title": "html2canvas",
"name": "html2canvas",
"title": "html2canvas-cors",
"name": "html2canvas-cors",
"description": "Screenshots with JavaScript",
"main": "dist/html2canvas.js",
"module": "dist/html2canvas.esm.js",
@ -111,6 +111,6 @@
"homepage": "https://html2canvas.hertzen.com",
"license": "MIT",
"dependencies": {
"css-line-break": "1.1.1"
"css-line-break": "^1.1.1"
}
}

View File

@ -128,7 +128,11 @@ export class Cache {
if (isInlineBase64Image(src) || useCORS) {
img.crossOrigin = 'anonymous';
}
if (src.indexOf('data:') === -1)
src = `${src}${src.indexOf('?') > -1 ? '&' : '?'}v=${new Date().getTime()}`;
img.src = src;
if (img.complete === true) {
// Inline XML images may fail to parse, throwing an Error later on
setTimeout(() => resolve(img), 500);