打开 js 变量的保存文件对话框 [英] Open a save file dialog for a js variable

查看:33
本文介绍了打开 js 变量的保存文件对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网络应用程序中,我需要为用户提供将 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).

就像谷歌文档提供你保存文件一样.

Similarly as google docs offers you to save a file.

javascript可以这样传递它的变量吗?

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

推荐答案

查看 Downloadify 允许正是这个.

Check out Downloadify which allows exactly this.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆