Java Applet 运行 NPAPI 在 Chrome 中的替代品

Alternatives to Java Applet running with NPAPI in Chrome

我们有一个 Applet,用于在客户端计算机上压缩文件并将内容流式传输回我们的服务器。我们更新到 Chrome 较新版本的客户无法再使用我们的小程序,因为 Chrome 不再支持 NPAPI 插件。 我想我有几个选择:

  1. 以某种方式使现有的 Applet 与 Chrome(可能使用 JNLP?)或其他方法一起工作
  2. 完全找到替代技术

解决方案必须能够接收文件夹、子文件夹和文件名的列表。然后它必须能够压缩这些文件,如果可能的话,然后将它们上传到服务器。我愿意接受任何建议。

你可以

  • 使用 File API, potentially letting the user add them to your interface via drag and drop 读取文件(比枯燥的 <input type="file"> 更方便的选择机制 :-))。

  • 使用 JSZip 之类的库将它们压缩到 JavaScript 中(尽管如果您的服务器启用了 gzip,我不确定这样做是否有很多收获;不过我还没有深入研究过)

  • 通过 HTTP POST(可能是多个帖子)或使用 XMLHttpRequest2, or via web sockets.

  • 将它们发送到服务器

当然,您的另一个选择是继续使用 Java 并让用户使用 Firefox 而不是 Chrome。请注意,Mozilla 也在寻求摆脱 NPAPI 并不再支持 Java。大约 20 个月前 they weren't:

there are no plans of dropping support for java or other npapi plugins in firefox other than setting them to "ask to activate": https://blog.mozilla.org/security/2014/02/28/update-on-plugin-activation/

..但是 now:

Mozilla intends to remove support for most NPAPI plugins in Firefox by the end of 2016. Firefox began this process several years ago...

(第一个引号中 "no plans" 的谎言)

...Websites and publishers which currently use plugins such as Silverlight or Java should accelerate their transition to Web technologies.