Save or Download Javascript String as a file

為{幸葍}努か 提交于 2019-12-14 03:55:42

问题


I have an HTML string in javascript variable. I have to save/Download the string as a file on link click. It should be cross browser compatible.

I thought window.open with attachment Content-Disposition header, but not good solution because popup may be blocked.


回答1:


As mentioned here, you could use downloadify: https://github.com/dcneiner/Downloadify. The client will need flash though.



来源:https://stackoverflow.com/questions/4439296/save-or-download-javascript-string-as-a-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!