I am trying to download a text file that i created using the file space api on chrome. I am unable to download it. I can only view it on the chrome browser itself.
location.href = fileEntry.toURL();
That is the line of code i currently use to download it.
Could i use content-disposition to force download a .txt file? if so, how?
I am trying to download a text file that i created using the file space api on chrome. I am unable to download it. I can only view it on the chrome browser itself.
location.href = fileEntry.toURL();
That is the line of code i currently use to download it.
Could i use content-disposition to force download a .txt file? if so, how?
Share Improve this question asked Aug 24, 2011 at 18:30 PraveenPraveen 1,8517 gold badges27 silver badges32 bronze badges1 Answer
Reset to default 6Check out the FileSaver
interface: http://www.w3/TR/file-writer-api/#the-filesaver-interface.
Here's a sample that does what you want: http://oftn/projects/FileSaver.js/demo/
Here's an HTML5Rocks post that describes usage in more detail: http://updates.html5rocks./2011/08/Saving-generated-files-on-the-client-side
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742331997a4423905.html
评论列表(0条)