Java Applet 使用 Chrome 浏览器启动客户端程序的替代方法是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30482949/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 17:11:35  来源:igfitidea点击:

What is the alternatives for Java Applet to launch client programs using Chrome browsers?

javagoogle-chromeappletclient-side

提问by Usama

I am working in a web application using ASP.net and C#.

我正在使用 ASP.net 和 C# 的 Web 应用程序中工作。

My target is to check on a desktop application on the client machine .. If it was exist then I should launch it. Else if it wasn't exist, we should download, install and then launch it.

我的目标是检查客户端计算机上的桌面应用程序。如果它存在,那么我应该启动它。否则,如果它不存在,我们应该下载、安装然后启动它。

I could develop this module using Java Applet but unfortunately, Google decided to disable NPAPI in September 2015, So the applet will not working on Chrome.

我可以使用 Java Applet 开发此模块,但不幸的是,Google 在 2015 年 9 月决定禁用 NPAPI,因此该 Applet 将无法在 Chrome 上运行。

My question is about the Applet alternatives to help me implementing the above scenario ?

我的问题是关于帮助我实现上述场景的 Applet 替代方案?

采纳答案by Usama

After searching about the most suitable way to achieve my goal, I think using custom protocolswill be a nice solution to access my client applications from the web page.

在搜索了最合适的方式来实现我的目标后,我认为使用自定义协议将是从网页访问我的客户端应用程序的一个很好的解决方案。

This solution is used by many companies such as Microsoft (using mailto: to open Outlook application)and Apple (using itms: to open iTunes application).

微软(使用mailto:打开Outlook应用程序)Apple(使用itms:打开iTunes应用程序)等许多公司都使用这种解决方案。

The following link is a very good link which talk about a custom protocols: https://support.shotgunsoftware.com/entries/86754-How-to-launch-external-applications-using-custom-protocols-rock-instead-of-http-

以下链接是一个很好的链接,它讨论了自定义协议:https: //support.shotgunsoftware.com/entries/86754-How-to-launch-external-applications-using-custom-protocols-rock-instead-of -http-

回答by Ulysses Marins

Once Google Chrome was the first to announce that they won't be supporting NPAPI anymore, they were also the first to provide a new architecture in order to rewrite your code to work on their browser. You can take a look on Native Messaging, which “can exchange messages with native applications using an API that is similar to the other message passing APIs”. The problem is that this approach only works on Chrome, is not something that you can adapt to other browsers.

Google Chrome 第一个宣布不再支持 NPAPI 后,他们也第一个提供了新的架构,以便重写您的代码以在其浏览器上运行。您可以查看 Native Messaging,它“可以使用类似于其他消息传递 API 的 API 与本机应用程序交换消息”。问题是这种方法只适用于 Chrome,不能适应其他浏览器。

A more useful approach is FireBreath, a browser plugin in a post NPAPI world. Check the words below from one buddy of the project:

一个更有用的方法是 FireBreath,一个后 NPAPI 世界中的浏览器插件。从项目的一位好友那里检查以下的话:

“FireBreath 2 will allow you to write a plugin that works in NPAPI, ActiveX, or through Native Messaging; it's getting close to ready to go into beta. It doesn't have any kind of real drawing support, but would work for what you describe. The install process is a bit of a pain, but it works. The FireWyrm protocol that the native messaging component uses could be used with any connection that allows passing text data; it should be possible to make it work with js-ctypes on firefox or plausibly WEB-RTC or even CORS AJAX in some way. For now the only thing we needed to solve was Chrome, but we did it in a way that should be pretty portable to other technologies.”

“FireBreath 2 将允许您编写一个在 NPAPI、ActiveX 或通过 Native Messaging 工作的插件;它已接近准备进入测试版。它没有任何真正的绘图支持,但可以满足您的描述。安装过程有点痛苦,但它有效。本地消息传递组件使用的 FireWyrm 协议可以与任何允许传递文本数据的连接一起使用;应该有可能让它以某种方式与 js-ctypes 一起工作在 Firefox 上,或者似乎是 WEB-RTC 甚至是 CORS AJAX。目前,我们唯一需要解决的问题是 Chrome,但我们以一种应该可以移植到其他技术的方式来解决。”

回答by Andrew Thompson

The only (semi) viable option as far as I can see, is to offer the Chrome user a link to a JNLP file for a desktop application. Then when/if the JWS desktop application starts, have it report back to the server 'loaded OK' and then 'target app. installed/not installed'.

据我所知,唯一(半)可行的选择是为 Chrome 用户提供一个指向桌面应用程序 JNLP 文件的链接。然后,当/如果 JWS 桌面应用程序启动时,让它向服务器报告“加载正常”,然后“目标应用程序”。安装/未安装'。

On your server, have a time out for waiting on the client to report back. If it passes that time, presume the client machine does not support Java at all and the user is checking some web service to try and figure out what app. opens a JNLP!

在您的服务器上,花一些时间等待客户端返回报告。如果过了那个时间,则假定客户端计算机根本不支持 Java,并且用户正在检查某些 Web 服务以尝试找出什么应用程序。打开 JNLP!