Java小程序可以打开“选择目录"吗?并通过 JavaScript 交互写入文件系统? [英] Can a Java applet open a "select directory" and write to a filesystem via JavaScript interaction?
问题描述
我正在寻找一种方法来保存在客户端计算机上使用 JavaScript 创建的几个文件.我希望他能够选择一个文件夹(类似于打开/保存文件夹对话框),然后在那里写入文件.这显然需要三件事:
I am looking for a way to save a couple of files created with JavaScript on the clients computer. I want him to be able to choose a folder (similar to open/save folder dialog), and then write the files there. This obviously requires three things:
- 能够弹出这样的对话框.
- 能够在客户的计算机上书写(签名的小程序?)
- 某种与 JavaScript 交互的方式,因为它知道要写入的文件名和内容.
这是可能的还是我应该停止做梦?
Is this possible or should I just stop dreaming?
推荐答案
当然有可能.
一种方法是使用签名小程序,但如果您的用户愿意升级到 Java 1.6.0_10+,则不需要签名小程序.从 1.6.0_10(下一代 Java 插件)开始,JNLP API 服务可用于嵌入式小程序.这是一个 演示.的 JNLP 文件服务.
One way is to use a signed applet, but if your users are willing to upgrade to Java 1.6.0_10+, a signed applet is not needed. Since 1.6.0_10 (the Next Generation Java Plug-In), JNLP API services are available to embedded applets. Here is a demo. of the JNLP file services.
我看到另一个回复已经涵盖了小程序/JS交互.
I see the other reply has already covered the applet/JS interaction.
这篇关于Java小程序可以打开“选择目录"吗?并通过 JavaScript 交互写入文件系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!