简体   繁体   English

"如何在客户端启动桌面应用程序"

[英]how to start up a desktop application in client side

In my web page, I have to start a desktop application on the client's computer if it's installed.在我的网页中,如果已安装,我必须在客户端计算机上启动一个桌面应用程序。 Any idea how I can do this?知道我该怎么做吗?

If the application is MS Office or Adobe Reader, I know how to start them, but the application I want to start is a custom application.如果应用程序是 MS Office 或 Adob​​e Reader,我知道如何启动它们,但我要启动的应用程序是自定义应用程序。 You can not find it on the internet.你不能在互联网上找到它。

How can I open the application?如何打开应用程序?

"

Basically it's not possible to achieve unless an application registers a protocol that will trigger it. 基本上,除非应用程序注册将触发它的协议,否则无法实现。 If it does that all you need to do is to provide a link using this protocol 如果这样做,您需要做的就是使用此协议提供链接

yourcustomapp://some.parameters yourcustomapp://some.parameters

Another way the 3rd party app can integrate with the browser is if it hooks to it as a plugin. 第三方应用程序可以与浏览器集成的另一种方式是它是否作为插件挂钩。 This is how flash apps work etc. 这就是Flash应用程序的工作方式等

If the app you are trying to launch does not support something like that it's going to be close to impossible to achieve what you want. 如果您尝试启动的应用程序不支持类似的功能,那么实现您想要的功能几乎是不可能的。

The browser sandbox prohibits you from executing local resources, for good reason - to thwart a website destroying your box with malicious code. 浏览器沙箱禁止您执行本地资源,这是有理由的 - 阻止网站使用恶意代码破坏您的邮箱。 I've been researching the same functionality. 我一直在研究相同的功能。

The only solution I've found is to build an extension in Mozilla Firefox which can launch your app. 我发现的唯一解决方案是在Mozilla Firefox中构建一个可以启动你的应用程序的扩展。 Extensions live outside the sandbox so they can execute local resources. 扩展程序位于沙箱之外,因此可以执行本地资源。 See this page for how to do that. 请参阅此页面了解如何执行此操作。 You may be able to do it cross-browser using crossrider , though I haven't had success with that yet. 您可以使用crossrider进行跨浏览器操作,但我还没有成功。

You could alternatively build a thick client populated from a web service, and launched from the browser through an extension as mentioned above. 您也可以构建一个从Web服务填充的胖客户端,并通过上面提到的扩展从浏览器启动。 This is what I'm doing to get around the sandbox. 这就是我正在做的绕过沙箱的事情。 I'm using local XUL for this. 我正在使用本地XUL

See my question for additional discussion. 有关其他讨论,请参阅我的问题

First off - you can't do it using javascript in any sort of a portable mechanism. 首先 - 你不能在任何类型的便携式机制中使用javascript。

If the application is ms office or adobe reader,I know how to startup them 如果应用程序是ms office或adobe reader,我知道如何启动它们

No you don't - you know how to send a document, which the browser associates with these applications and invokes them supplying the name of the local copy of the response. 不,你不知道 - 你知道如何发送一个文档,浏览器与这些应用程序关联,并调用它们提供响应的本地副本的名称。 You can't just start the programs. 你不能只是启动程序。

You just need to do the same for your app - invent a new mime type (the major type would be 'application' and by convention, non-standard minor types are prefixed with 'x-', so you might use application/x-hguser) then associate that mimetype with the relevant program browser side. 你只需要为你的应用程序做同样的事情 - 发明一个新的mime类型(主要类型是'应用程序',按照惯例,非标准的次要类型以'x-'为前缀,所以你可以使用application / x- hguser)然后将该mimetype与相关的程序浏览器端相关联。

ie: You need to explicitly configure each browser 即:您需要显式配置每个浏览器

I already encouter that problem in some complex production environnements. 我已经在一些复杂的生产环境中解决了这个问题。

I do the trick using the following code : 我使用以下代码来解决这个问题:

function launch(p_app_path)
{
   var oShell = new ActiveXObject("WScript.Shell");
   oShell.Run('"' + p_app_path + '"', 1);
}

In IE options > Security > Customize the level > ActiveX controls and plugins > Initialization and script ActiveX controls not marked as safe for scripting , set the value to Ask or Active . 在IE 选项>安全性>自定义级别> ActiveX控件和插件>初始化和脚本未标记为可安全执行脚本的ActiveX控件中 ,将值设置为“ 询问”或“ 活动”

It isn't a security problem when your website is enclosed into a specific security context. 当您的网站包含在特定的安全上下文中时,这不是安全问题。 And as they say, it's not worth it to build a gas plant. 正如他们所说,建造天然气厂并不值得。

JavaScript alone can't do this. 仅JavaScript不能做到这一点。 (No, not even with MS Office or Adobe Reader.) Thankfully. (不,甚至不使用MS Office或Adobe Reader。)谢天谢地。

There are a number of old ways, including using ActiveX , which may work for your needs. 有许多旧方法,包括使用ActiveX ,它可能适合您的需要。 As others have pointed out while typing this, you can customize responses based on the mime type or the protocol, etc. 正如其他人在输入时指出的那样,您可以根据mime类型或协议等自定义响应。

Any way you look at it, you're going to need control over the end users' browser. 无论你如何看待它,你都需要控制最终用户的浏览器。 If you're in a close environment where you can dictate policy (users must use a specific browser, with a specific configuration), then you're going to need to do that. 如果您处于可以指定策略的密切环境中(用户必须使用特定浏览器,具有特定配置),那么您将需要这样做。 For an open environment with no control over the end users, you're out of luck. 对于无法控制最终用户的开放环境,您运气不佳。

I'm actually having a lot of success right now with SiteFusion . 我现在使用SiteFusion实际上取得了很大的成功。 It's a PHP client/server application framework that serves out XUL/JavaScript applications from a server deamon running in Apache. 它是一个PHP客户端/服务器应用程序框架,它从Apache中运行的服务器守护程序提供XUL / JavaScript应用程序。 You access applications from a very thin client in XULRunner, or potentially off a web page using extensions. 您可以从XULRunner中的非常瘦的客户端访问应用程序,也可以使用扩展从Web页面访问。 Clients can execute on any platform, and they're outside of the browser sandbox so you can access local resources such as executables. 客户端可以在任何平台上执行,并且它们位于浏览器沙箱之外,因此您可以访问本地资源(如可执行文件)。 It'a a fairly elegant solution, their website provides great examples and documentation, and their forum is very responsive. 它是一个相当优雅的解决方案,他们的网站提供了很好的示例和文档,他们的论坛非常敏感。 I actually found a minor bug in passing arguments to local executables, posted a question about the forum, and it was fixed by the chief developer in under 15 minutes. 我实际上在向本地可执行文件传递参数时发现了一个小错误,发布了一个关于论坛的问题,并且它由主要开发人员在15分钟内修复。 Very impressive, overall! 非常令人印象深刻

The URL above to make extension is obsolete now.上面用于扩展的 URL 现在已过时。 Current URL: First Web extension<\/a>当前 URL: 第一个 Web 扩展<\/a>

"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何开始在JS中开发简单聊天应用程序的服务器和客户端? - How to start developing server and client side of simple chat application in JS? 如何仅使用客户端解决方案呈现用于桌面设备的Javascript和CSS? - How to render a Javascript and CSS for desktop devices only with client side solution? 如何检测页面请求来自移动或桌面客户端 - How to detect a page request is from mobile or desktop client side 如何使用javascript客户端设置Python服务器端 - How to set up Python server side with javascript client side 如何使用Silverlight与客户端应用程序进行通信 - How to communicate to a client side application with silverlight 这个客户端应用程序安全吗? - Is this client side application secure? 用于连接到客户端桌面应用程序的网站 - Website to connect to a client desktop application 如何使用 javascript 发送带有客户端应用程序洞察的“应用程序版本”? - How to send 'Application Version' with client side application insights using javascript? 如何在客户端设置一个JS Require工具来require(&#39;net&#39;)? - How to set up a JS Require tool to require('net') on the client side? 如何使用客户端脚本加速Ajax调用 - How to speed up Ajax Calls using client side scripting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM