从浏览器中启动一个可执行文件(Windows)中 [英] Launch an exe from browser (Windows)

查看:162
本文介绍了从浏览器中启动一个可执行文件(Windows)中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要启动浏览器从(不仅仅是IE)已安装的应用程序。

I need to launch an installed application from browser (not just IE).

线程我明白,我需要实现的异步可插接式协议并的注册应用程序的URI方案

From this thread I understood that I need to implement asynchronous pluggable protocols and registering an application to uri scheme.

我想检查是否有实现它的其他方法吗?

I would like to check if there are any other ways of implementing it?

在我的情况,我预计将推出从客户端计算机现有的应用程序。所以,我可以注册该应用程序的URI方案,并使用它。

In my scenario I am expected to launch an existing application from the client machine. So can I register this application to uri scheme and use it.

我唯一担心的是在这两种方案(或至少是第二个方案),我们必须使注册表更改。如果注册表设置不present这是不行的。

My only concern is in both the scenarios(or at least the second scenario) we have to make registry changes. And if the registry settings are not present this won't work.

有不依赖于注册表设置或prerequisites任何其他方式。

Is there any other way which doesn't depend on registry settings or any prerequisites.

感谢。

推荐答案

有没有一种方法来调用浏览器之外的可执行没有类型的您所描述的东西(我可能会使用该应用程序的URI方案在地方,因为它是你的一部分,至少定义插件工作)。这是因为,如果你可以调用任何应用程序,而不需要一个注册表编辑或一些相关更改的用户,你可以做任何你与你知道会是用户的计算机上的任何应用程序想要的。这就是所谓的沙箱和<一个href=\"http://www.howtogeek.com/169139/sandboxes-explained-how-theyre-already-protecting-you-and-how-to-sandbox-any-program/\"相对=nofollow> HOWTO GEEK 上有一个像样的文章。

There isn't a way to call an executable outside the browser without the types of things you described (and I'd probably use the application URI scheme in your place because it's the least custom plugin work on your part). This is because if you could call any application without the user requiring a registry edit or some related change, you could do anything you wanted with any application you know would be on the users' machine. It's called sandboxing, and HOWTO GEEK has a decent article on it.

沙盒是一个严格控制的环境下,程序可以
  跑。沙箱限制哪些一张code能做到,给它就像
  许多权限,因为它需要无需增加额外的权限
  这可能会被滥用。

A sandbox is a tightly controlled environment where programs can be run. Sandboxes restrict what a piece of code can do, giving it just as many permissions as it needs without adding additional permissions that could be abused.

例如,Web浏览器基本上是运行在你访问网页
  沙盒。他们限制在浏览器中运行和访问
  在有限的资源集 - 不,他们无法查看你的摄像头
  许可或阅读您的计算机的本地文件。如果您访问的网站
  没有沙箱,并从系统的其余部分隔离,访问
  恶意网站会像安装一个病毒一样糟糕。

For example, your web browser essentially runs web pages you visit in a sandbox. They’re restricted to running in your browser and accessing a limited set of resources — they can’t view your webcam without permission or read your computer’s local files. If websites you visit weren’t sandboxed and isolated from the rest of your system, visiting a malicious website would be as bad as installing a virus.

正如他们所指出的,你已经在沙箱中,当你在浏览器中是。如果要编写能够从内部那里访问的应用程序,你需要的功能和HTML,JavaScript的,等等。

As they point out, you're already in a sandbox when you're in the browser. If you want to write an application that can be accessed from within there, you need to work within the capabilities and restrictions of HTML, JavaScript, etc.

从自己的 MSDN链接可以看到在Windows上,

From your own MSDN link you can see that on Windows,

如果没有这个键,处理器应用程序将不会启动。

Without this key, the handler application will not launch.

您后,似乎表明Windows是确实的相关目标操作系统。如果你想这样做的另一个操作系统(或者如果别人读了这个问题),这些方法会从你已经找到不同(这些都已经堆栈溢出的问题):

Your post seems to indicate that Windows is indeed your relevant target OS. If you want to do this on another operation system (or if someone else reads this question), the methods will vary from what you already found (these are already Stack Overflow questions):

  • OSX and iOS
  • Android
  • Linux

在理论上,你的可能的创建具体到每一个可能的浏览器做一些完全自定义插件或配置应用程序。但是,你会重新发明轮子,因为你需要同样的权利高度来安装你的应用程序/插件。此外,你会重塑上述协议,并以某种方式分配提前时间进行安装应用程序。

In theory, you could create plugins or configuration applications specific to each likely browser to do something totally custom. However, you'd be reinventing the wheel because you'd need the same rights elevation to install your app/plugin. Additionally, you'd be reinventing the protocol mentioned above and somehow distributing the application for installation ahead of time.

此外,有时它看起来像应用被利用像网络摄像头访问和地理定位新的网络功能时,顺利地获得访问到用户的浏览器的体验。我们现在实际上看到的是到位的Flash小程序和其他东西有点新的JavaScript API,我们用于需要通过第三方软件来利用。

Also, sometimes it looks like applications are smoothly gaining access to the user's browser experience when new web functionality like webcam access and geolocation is being utilized. What we're actually seeing here is somewhat new JavaScript APIs in place of Flash applets and other things we used to need to harness through 3rd party software.


  • getUserMedia (或者它可能是 webkitGetUserMedia mozGetUserMedia 取决于浏览器)允许从网络摄像头和麦克风使用的媒体。浏览器已经实现了权限提示,允许在此之前,但应用仍是一个JavaScript的应用程序。

  • 地理位置API被写入到HTML5标准这里和最简单的实现( JavaScript的)是这样的: navigator.geolocation.getCurrentPosition(show_map); 它仍然只是一个JavaScript库。如果你使用它,本网站提到加入一些错误处理/回退和这样的。它可提供IE 9开始请参阅链接其他浏览器。

  • 您可以使用 navigator.registerProtocolHandler (阅读更多的 Mozilla的文档这里)然而,除了内置的协议(邮寄地址,例如),你要寻找在同一个域与Web应用程序处理URI作为你在哪里'再调用这个函数。要建立一个处理程序,其中的链接协议汉堡&LT; A HREF =汉堡:芝士汉堡&GT;该&lt; / A&GT; 将被处理,你可以写: navigator.registerProtocolHandler(汉堡
                                  http://www.google.co.uk/?uri=%s
                                  汉堡处理程序);
    你可以找到在的 W3C规范,包括其他列入白名单的计划,但你需要做很多的浏览器,支持并确保您的目标受众可以使用这个精心采摘。我喜欢引用 CanIUse 每当我要确定浏览器的支持。 它看起来像Chrome和Firefox是和IE浏览器也不行。

  • 我所做的仅仅是找到一种方法,螺栓上像这样的一些功能在Ubuntu中加入了协​​议处理程序如果您承担,让您的所有客户机使用链接之前运行一些脚本(使用sudo权限)的能力。这是多么贴切:在Ubuntu链接调用程序包管理器。由于这回来到的境界创建安装脚本,可以在注册表编辑MIME类型为Windows的解决方案,我想我可以在这里停下来。

  • getUserMedia (or it might be webkitGetUserMedia or mozGetUserMedia depending upon the browser) allows use of media from the webcam and mic. Browsers have implemented a permission prompt before allowing this, but the application is still a JavaScript app.
  • The Geolocation API is written into the HTML5 standard here and the simplest implementation (JavaScript) would look like this: navigator.geolocation.getCurrentPosition(show_map); It's still simply a JavaScript library. If you use it, this site mentions adding some error handling / fallback and such. It's available starting with IE 9. See that link for other browsers.
  • You can use navigator.registerProtocolHandler (read more here from Mozilla docs) However, besides built in protocols (mailto, for instance), you're going to be looking at handling the URI with a web application on the same domain as where you're calling this function. To set up a handler where the protocol burger in the link <a href="burger:cheeseburger">this</a> will be handled, you could write: navigator.registerProtocolHandler("burger", "http://www.google.co.uk/?uri=%s", "Burger handler"); You could find more information at the W3C spec, including other whitelisted schemes but you'd need to do a lot of careful picking of browsers to support and ensure your target audience can use this. I like to reference CanIUse whenever I want to determine browser support. It looks like Chrome and Firefox are in and IE is out.
  • I did just find a way to bolt on some functionality like this in Ubuntu by adding a protocol handler, IF you assume the ability to get all your client machines to run some scripts (with SUDO rights) before using the links. This is how apt: links in Ubuntu call the package manager. Since this gets back into the realm of "create an install script that can edit MIME types in the registry" for a Windows solution, I think I can stop here.

这篇关于从浏览器中启动一个可执行文件(Windows)中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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