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

File save issue in Safari #129

Closed
bhattkrishna19 opened this issue Feb 12, 2015 · 14 comments
Closed

File save issue in Safari #129

bhattkrishna19 opened this issue Feb 12, 2015 · 14 comments
Labels

Comments

@bhattkrishna19
Copy link

bhattkrishna19 commented Feb 12, 2015

I am using this code

var blob = new Blob([atob(response.payload)], {
    "data":"attachment/csv;charset=utf-8;"
});
saveAs(blob, fname);

Here response.payload is blob data. Its working fine in all browsers but in safari file getting downloaded without name and opening a blank page also. Any help will be highly appreciated.

@DanielMSchmidt
Copy link

This seems to be a missing feature: https://github.com/eligrey/FileSaver.js#supported-browsers

@ragefuljoe
Copy link

what is the current recommended way to save things in safari 8? downloadify doesn't seem to work for me, or at least have not found a demo that works in safari. using saveas just silent fails in my test while working in other browsers.

@MichelFloyd
Copy link

I'm seeing the same problem. Certain file types (e.g. images) open in a new browser tab as blob:... Other file types (e.g. MS Office documents) open a new blank browser tab with no URL at all in the address bar and no file is downloaded. Safari 7.1.5

@cvrebert
Copy link

Duplicate of #12?

@MichelFloyd
Copy link

Seems to be == #12

@zerdos
Copy link

zerdos commented Apr 12, 2016

So the problem is the time. If the saveAs happens more than 1 second after the click what triggered it, the plugin will overwrite the current window.

@ivanstojkovicapps
Copy link

having the same problem in Safari. Firefox and Chrom are working! How to prevent this?

@dominicarrojado
Copy link

If there's no fix yet, how would I make the saveAs open a new tab instead of overwriting the current window?

@asith-w
Copy link

asith-w commented Apr 27, 2016

is there any update on this issue ?

@orenmagen100
Copy link

plz?

@cshanejennings
Copy link

cshanejennings commented May 19, 2016

Any movement on this? I'm seeing some activity on the webkit bugs thread https://bugs.webkit.org/show_bug.cgi?id=102914 as recently as april. Does anyone know the status of this patch and / or if there are any workarounds?

@cvrebert
Copy link

They still have some work to do; see the transitive dependencies of that bug. Lots of recent-ish activity that looks promising though.

@jimmywarting
Copy link
Collaborator

jimmywarting commented May 31, 2016

the data is wrong, it should be { type: "attachment/csv;charset=utf-8" }

Try setting the mimetype to application/octet-stream to force saving. You will not be able to set the filename, it will default to "unknown" but it's the best you got, another option is to set the mimetype to "text/plain" so it will open it in a new tab so the client can decide where to save and also name it.

var blob = new Blob(['"User","Text"'], {
    "type":"application/octet-stream"
})
saveAs(blob);

FileSaver.js will try to open a new tab window.open but you are only allowed to do so within 1 secound after a user interaction like onclick

if the window.open fails it will replace the current tab but faile to do so if the mimetype can't be renderd by safari

@meash-nrel
Copy link

Looks like Safari 10.1 finally supports the Download attrib.

http://caniuse.com/#feat=download
https://webkit.org/status/#feature-download-attribute

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

No branches or pull requests