kennethjiang / js-file-download

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Safari

rudovjan opened this issue · comments

Unfortunately this plugin does not work with safari. Any plan to take a look on that?

Sorry for the delay. I've been tied up recently.

This is a known issue. Look at issue #5. It seems there is a fork to address Safari rmiller-fc@12c4312. I can't merge that fix though as it breaks the current behavior of opening up download in a new tab.

Of course if you have better solution feel free to send in a PR @rudovjan

Thank you!

Strange thing happened :) So I copy&paste your code into project, change it into ES6, let it compile with babel and code started working.

  1. If i left it as a es5 dependency it does not work
  2. compiled to es5 using babel, started to work

Once will have little bit more time, I have a plan to take a look on that.

Great. It'll be awesome if you can help add transpiler to this project (using rollup or similar tool) so that everyone can benefit from your work!

@kennethjiang I've created a simple PR with a fix/workaround: #55

Sorry just saw your comment. Can you give a bit more details on how your PR fixes this issue? Thanks lot @exihuatl

@kennethjiang The problem is that we are removing blob in the same cycle as opening a new window. This causes some problems for iOS Safari which shows an enigmatic error message.

Some resources:
https://discussions.apple.com/thread/250191294
mozilla/pdf.js#8152
https://bugs.webkit.org/show_bug.cgi?id=190351

All this PR does is ensuring that the resource exists while opening a new window.

The problem still exists on Safari/13.3.1. Sometimes it works, sometimes it's not. Behavior is unstable. Look's like 0 timeout is not enough.

I believe that #63 fixes this issue (which has been released in 0.4.12). If this issue still persists, please feel free to open a new issue.