4

Alright, so I have this webpage page that gets its data using AJAX requests (in javascript using JQuery). Once the data has been loaded on to the users browser I want to let them download said data without having to request it from the server again.

To do this, I found this little bit of code (in Javascript):

window.location = 'data:text/csv;charset=utf8,' + encodeURIComponent(someCSVtext);

This does what I want it to do, but it always names the file "download.csv"

Is there a way I can preset the filename assuming the user has an "always download file" option set in their browser (thus don't get a chance to rename the file)?

DJ SymBiotiX
  • 187
  • 2
  • 12
  • No, that's not possible, at least if things have not changed since a few months ago when I was experiencing this same issue. However, if you support newer browsers you may want to look at this topic to solve it another way: http://stackoverflow.com/questions/7160720/create-a-file-using-javascript-in-chrome-on-client-side/7160827#7160827. – pimvdb Oct 27 '11 at 21:11

0 Answers0