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

docs: saveAs in iOS does not open in new tab as described #752

Open
bwhite94 opened this issue Apr 6, 2022 · 7 comments
Open

docs: saveAs in iOS does not open in new tab as described #752

bwhite94 opened this issue Apr 6, 2022 · 7 comments

Comments

@bwhite94
Copy link

bwhite94 commented Apr 6, 2022

In the Readme it mentions:

Due to restrictions in iOS saveAs opens in a new window instead of downloading

But this is not the behavior seen in FileSaver.js version 2.0.5 and iOS 14.x. Instead the file is opened in the same tab, causing the user to potentially lose what they were doing before saving the file.

@maciej-zabielski
Copy link

I have the same issue in Firefox 100.0.2
When downloading a file using
saveAs(xhr.response, fileName, saveAsOpts);
The current tab is replaced by the download. In Chromium it triggered file download in a deciated "download menu".

@bwhite94 have you found any solution to this?

@joancipria
Copy link

@maciej-zabielski It looks like it is a Firefox bug as mentioned in #581 (comment). It should be fixed in Firefox 101.

@mylifeandcode
Copy link

Still seeing this behavior. Looking for a workaround. Happening in Safari.

@bwhite94
Copy link
Author

@mylifeandcode I don't have the code right in front of me, but I believe I made the switch to manually open a new tab with the blob data URL. I can confirm for you on Monday.

@mylifeandcode
Copy link

Thanks @bwhite94 , that would be great. In the meantime, I'm looking at the code trying to figure that out for myself. I'm glad to know there is a way -- thanks!

@bwhite94
Copy link
Author

bwhite94 commented Jul 3, 2023

@mylifeandcode the solution we ended up using was specific to jsPDF. jsPDF does utilize FileSaver, so I'm not sure if this will 100% work for you, but you may be able to look through jsPDF docs and source code for this function to confirm. Our solution with jsPDF is below.

const doc = new jsPdf({ somePropsHere });

window.open(doc.output('bloburl'), '_blank');

@mylifeandcode
Copy link

Thanks @bwhite94 ! In my case, it wouldn't be applicable, but I appreciate the info, and it's good to know about jsPDF. I hadn't heard of it, and may need it in the future. Thanks for going through all the effort to provide an answer, it is very much appreciated. :)

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