fixing url

This commit is contained in:
Amine Ben hammou
2018-03-05 18:02:09 +01:00
parent ef5d777fac
commit d3f9fb5f06
3 changed files with 56 additions and 56 deletions

View File

@@ -10,7 +10,7 @@ import html2canvas from 'html2canvas';
*/
export const fromDom = element =>
html2canvas(element, {
allowTaint: true,
allowTaint: false,
useCORS: true,
foreignObjectRendering: true,
logging: false,
@@ -25,8 +25,8 @@ export const fromDom = element =>
export const fromUrl = url =>
new Promise((resolve, reject) => {
const iframe = document.createElement('iframe');
const protocol = location.href.startsWith('https://') ? 'https' : 'http';
iframe.src = protocol + url.replace(/^https?/, '');
const protocol = location.href.startsWith('https://') ? 'https:' : 'http:';
iframe.src = protocol + url.replace(/^https?:/, '');
iframe.style.opacity = 0;
iframe.onload = () => {
fromDom(iframe.contentDocument.documentElement)