打开js变量的保存文件对话框 [英] Open a save file dialog for a js variable
问题描述
在我的Web应用程序中,我需要为用户提供将js变量另存为文件的选项(当用户单击下载时,该应用程序将为他提供将文件另存为.js文件的功能.)
In my web app I need to give the user the option to save a js variable as a file (when the user clicks download, the app offers him to save a file, preffereably as .js file).
与Google文档类似,您可以保存文件.
Similarly as google docs offers you to save a file.
javascript是否可以通过这种方式传递变量?
Is it possible for javascript to pass it's variable this way?
推荐答案
查看 Downloadify 就是这个.
Downloadify是一个很小的JavaScript + Flash库,可在浏览器中即时生成和保存文件,而无需服务器交互.
Downloadify is a tiny JavaScript + Flash library that enables the generation and saving of files on the fly, in the browser, without server interaction.
但是,它要求在用户浏览器中安装Flash才能正常工作.
it requires Flash installed in the user's browser to work, though.
我知道没有服务器交互,没有其他方法可以做到这一点.
I know of no other way of doing this without server interaction.
这篇关于打开js变量的保存文件对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!