html - Download a text file created using HTML5 filespace api using javascript on chrome - Stack Overflow

I am trying to download a text file that i created using the file space api on chrome. I am unable to d

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 badges
Add a ment  | 

1 Answer 1

Reset to default 6

Check 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条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信