-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Use FileReader in macOS native apps using WebKit #613
Conversation
I have a similar issue where Like this: I suggest the isWebkit check is done before trying to find 'download', as isWebKit is a boolean that has already been calculated, so no need to perform the |
Hello @Floriferous I have submitted a PR to fix the problem in node environments since my tests were failing even if not trying to test FileSaver at all #620 620 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 👍 - I will merge your changes once you bump the version
@eligrey will do. Do you want me to rebuild the dist as well? |
Yeah, you should also re-build dist. Make sure that you also maintain compatibility with iOS as per #577. I don't have an iOS device to test. Thanks for taking the time to PR! |
@eligrey just tested, still works on iOS Chrome |
Using isWebKit before isSafari could cause Safari to use FileReader even if force === false, since the user agent for Safari also includes AppleWebKit
Includes eligrey/FileSaver.js#613, which fixes an issue on macOS when exporting SeedVaults
In a macOS native app that uses WebKit, calling
saveAs
on aBlob
attempts to open the blob URL. This results in a message that saysThere is no application set to open the URL blob:http...
(see iotaledger/spark-wallet#89 (comment)).As in Safari, the
FileReader
API should be used. However, changes need to be made to the browser detection because of a few differences between Safari and WebKit:HTMLAnchorElement.download
is definedtypeof FileReader
returns'function'
instead of'object'
With these changes, the expected behavior is achieved:
Fixes #509