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

Download of blob url is not working with elem.click() #8635

Open
karlcow opened this issue Jun 4, 2021 · 8 comments
Open

Download of blob url is not working with elem.click() #8635

karlcow opened this issue Jun 4, 2021 · 8 comments

Comments

@karlcow
Copy link
Contributor

karlcow commented Jun 4, 2021

Steps to reproduce (Firefox on iOS v34)

  1. Go to https://cubari.moe/read/gist/JG33X/9/1/
  2. spot the first toolbar with the down arrow, the link icon and the right angle arrow icon
  3. tap on the download button

Expected:
A menu is displayed asking to save the file 9.zip in Downloads

Actual:
a progress counter is shown but the modal menu doesn't appear.

The progress counter is client side and doesn't mean anything.
The real download happens with this piece of JavaScript.

  function initiateDownload(url) {
    let elem = window.document.createElement('a');
    elem.href = url;
    elem.download = Reader.SCP.chapter + '.zip';
    document.body.appendChild(elem);
    elem.click();
    document.body.removeChild(elem);
  }

It creates an html element with a blob url

<a href="blob:https://cubari.moe/771fec36-937a-c841-8e4d-c189a5d04c62" download="9.zip"></a>

that it clicks with elem.click()

This is not happening in Firefox iOS.

see the full diagnosis at webcompat/web-bugs#75388

┆Issue is synchronized with this Jira Task

@data-sync-user data-sync-user changed the title Download of blob url is not working with elem.click() FXIOS-1913 ⁃ Download of blob url is not working with elem.click() Jun 4, 2021
@ksy36
Copy link
Contributor

ksy36 commented Jun 11, 2021

There is a similar issue in webcompat/web-bugs#75965, but with an image. I've created a reduced test case for it: https://codepen.io/ksy36/pen/gOmdJWW

@karlcow
Copy link
Contributor Author

karlcow commented Jun 13, 2021

@ksy36 There is an error message in the console for the reduced test case.

Cannot access blob URL “blob:https://cdpn.io/a13d0093-357a-f548-a2bb-e5c63c308194” from a different agent cluster.

This leads to this error message in the source code.

which is associated with Add a console warning when blob URL partitioning is applied itself created because of Blob isolation regresses sandboxed iframe downloads and Can't export Google Contacts on Nightly.

@karlcow
Copy link
Contributor Author

karlcow commented Jun 13, 2021

I should have clarified in the previous comment in the case of gecko.
But this might lead us to the right thing. Specifically WKWebView does not support blob: URLs as href value in anchors with download attribute

@karlcow
Copy link
Contributor Author

karlcow commented Jun 14, 2021

I added a comment on https://bugs.webkit.org/show_bug.cgi?id=216918#c4

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale. Has the issue been fixed, or does it still require the community's attention? Please leave any comment to keep this issue opened. It will be closed automatically if no further update occurs in the next 30 days. Thank you for your contributions!

@github-actions github-actions bot added the stale Stalebot use this label to stale issues and PRs label Jan 21, 2023
@data-sync-user data-sync-user changed the title FXIOS-1913 ⁃ Download of blob url is not working with elem.click() Download of blob url is not working with elem.click() Jan 21, 2023
@ravicious
Copy link

I believe it still doesn’t work, at least the example from the first post.

@github-actions github-actions bot removed the stale Stalebot use this label to stale issues and PRs label Jan 22, 2023
@clemlesne
Copy link

Maybe related to #14053.

@karlcow
Copy link
Contributor Author

karlcow commented Jan 8, 2024

@denschub and others could you double check this might have been fixed.

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

4 participants