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