Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on safari 16 or lower #3216

Open
dataexcess opened this issue Nov 20, 2024 · 4 comments
Open

Not working on safari 16 or lower #3216

dataexcess opened this issue Nov 20, 2024 · 4 comments

Comments

@dataexcess
Copy link

My code is perfectly working on the latest safari, but on safari 16 or lower.. the completion callback is never called... in the logs I see an inital log

#3 � "0ms" � "Starting document clone with size 1359x6526 scrolled to 0,-90"
html2canvas.esm.js:5662

but nothing more is ever printed. it's simply stuck.

@erlangera
Copy link

onload event on iframe does not fire when resources load from local cache. When I disable cache in network tab it works well, you can see something about it #2864.

@erlangera
Copy link

My suggest is replace code html2canvas.js:

DocumentCloner.prototype.toIFrame = function (ownerDocument, windowSize) {
            var _this = this;
            var iframe = createIFrameContainer(ownerDocument, windowSize);
            if (!iframe.contentWindow) {
                return Promise.reject("Unable to find iframe window");
            }

to:

DocumentCloner.prototype.toIFrame = async function (ownerDocument, windowSize) {
            var _this = this;
            var iframe = createIFrameContainer(ownerDocument, windowSize);
            if (!iframe.contentWindow) {
                return Promise.reject("Unable to find iframe window");
            }
            // add delay
            await new Promise(resolve => setTimeout(() => {
                resolve()
            }, 500))

Hope can help you!

@yuguaa
Copy link

yuguaa commented Dec 23, 2024

I WILL TRY

@yuguaa
Copy link

yuguaa commented Dec 23, 2024

My suggest is replace code html2canvas.js:

DocumentCloner.prototype.toIFrame = function (ownerDocument, windowSize) {
            var _this = this;
            var iframe = createIFrameContainer(ownerDocument, windowSize);
            if (!iframe.contentWindow) {
                return Promise.reject("Unable to find iframe window");
            }

to:

DocumentCloner.prototype.toIFrame = async function (ownerDocument, windowSize) {
            var _this = this;
            var iframe = createIFrameContainer(ownerDocument, windowSize);
            if (!iframe.contentWindow) {
                return Promise.reject("Unable to find iframe window");
            }
            // add delay
            await new Promise(resolve => setTimeout(() => {
                resolve()
            }, 500))

Hope can help you!

amazing dancing!!!!!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants