打开 js 变量的保存文件对话框

发布于 2024-09-04 00:05:10 字数 140 浏览 2 评论 0原文

在我的网络应用程序中,我需要为用户提供将 js 变量保存为文件的选项(当用户单击下载时,应用程序会要求他保存文件,最好是保存为 .js 文件)。

与谷歌文档类似,您可以保存文件。

javascript可以通过这种方式传递它的变量吗?

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).

Similarly as google docs offers you to save a file.

Is it possible for javascript to pass it's variable this way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

许一世地老天荒 2024-09-11 00:05:10

查看 Downloadify ,它完全允许这样做。

Downloadify 是一个小型 JavaScript + Flash 库,可以在浏览器中动态生成和保存文件,无需服务器交互。

不过,它需要在用户浏览器中安装 Flash 才能工作。

我知道没有其他方法可以在没有服务器交互的情况下做到这一点。

Check out Downloadify which allows exactly this.

Downloadify is a tiny JavaScript + Flash library that enables the generation and saving of files on the fly, in the browser, without server interaction.

it requires Flash installed in the user's browser to work, though.

I know of no other way of doing this without server interaction.

云胡 2024-09-11 00:05:10

您可能还想查看 OpenSave:

http://www.gieson.com/Library /projects/utilities/opensave/

...看起来很像 Downloadify,但似乎有一些额外的功能(而且没那么复杂?)。

You might also want to check out OpenSave:

http://www.gieson.com/Library/projects/utilities/opensave/

... which looks much like Downloadify, but seems to have a few extra features (and not as complicated?).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文