开发者

Download the contents of a Javascript variable as a named file

I have the contents of a file in a Javascript variable. When the user clicks something (link, button, etc.) I want the "save as" dialog to appear with a filename specified by my code and when the user clicks "save", the contents of the Javascript开发者_StackOverflow中文版 variable are saved in the file.

I know how to do this using server-side code but that is not an option for this application.

I've seen several conversations on StackOverflow related to this issue and the difficulties surrounding it so I'm placing a bounty on this one to encourage creative thinking :)


Can't really say that this is my idea (I found it here of all places), but have you tried Downloadify? It will only work in the most modern browsers, but you don't really have a choice if you have no server-side component available.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜