从浏览器运行 .exe 文件(以任何方式)
我有一个页面可以让我控制本地网络中的一些设备。但是,某些高级设置只能使用位于运行配置页的计算机上的 .exe 文件进行设置。我希望将所有配置工具“放在一个地方”,因此最好有一种链接/块/按钮/Flash动画/无论什么 - 在用户单击后 - 将运行指定的.exe文件。我认为这是可能的,因为我见过使用网页启动的 MMO 游戏。我还怀疑 html/javascript 不会让我做类似的事情,所以也许答案是 Flash?希望你能有一些想法。
预先感谢您提供任何线索, 迈克尔.
I have got a page which lets me control some devices in a local network. However, some of the advanced settings can be set only using an .exe file which is located on the computer where I run the configuration page. I would like to have all the configurational tools "in one place" so it would be nice to have a kind of link/block/button/flash animation/whatever which - after being clicked by the user - would run a specified .exe file. I think that it is possible somehow, because I've seen MMO games which are launched using a webpage. I also suspect that html/javascript will not let me to do something like that, so maybe the answer is Flash? Hope you'll have some ideas.
Thank you in advance for any clues,
Michael.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
带有 文件 URI 的链接可能会起作用。你尝试过吗?
A link with a File URI might do the trick. Have you tried that?
有多种方法可以做到这一点,但这存在安全风险,因此如果没有用户的特定许可,您不能这样做。如果在 IE 上,您可以使用 activeX 来完成此操作,如果在其他浏览器上则更复杂 - 您可能需要安装特殊的插件或 dll。
一个简单的选择是将您的程序注册为某种类型 URI 的处理程序。如果您曾经在网络上看到过
itunes://
链接,如果您的计算机上安装了 itunes,它将直接启动 itunes。例如,这里解释了 itunes 是如何做到的< /a>.实际上,它是对如何停止它的解释,但您可以使用它来设置您自己的系统来执行相同的操作。完成此操作的另一个地方是 google chrome 下载页面。如果您曾经在(Windows)计算机上安装过任何谷歌产品,那么谷歌还会安装一个 dll,只需单击链接即可执行任何签名的谷歌产品。转到 google chrome 下载页面,您可以反转 javascript 看看他们是如何做到这一点的(最终有一个本机编译的 dll,尽管允许他们这样做),但是安装这个额外的软件使其变得非常无缝,尽管有点令人不安。
正如您所看到的,有多种方法。
There are ways to do this, but it is a security risk so you can't do it without the user's specific permission. If on IE, you can do this with activeX, if on another browser it is more complicated -- you may have to install a special addon or dll.
One easy option is to register your program as a handler for a certain type of URI. If you've ever seen
itunes://
links on the web, if you have itunes installed on your computer that will launch itunes directly. E.g. here's an explanation of how itunes does it. Actually it's an explanation of how to stop it, but you can use that to set up your own system to do the same thing.One other place where this is done is on the google chrome download page. If you've ever installed any google product on your (windows) computer, google also installs a dll that allows it to execute any signed google product just by clicking on a link. Go to the google chrome download page and you can reverse the javascript to see how they do this, (ultimately theres a natively compiled dll though that allows them to do it), but installing this extra software makes it quite seamless, although a little disturbing.
So as you can see there are a variety of methods.
您是否能够在要运行可执行文件的计算机上安装软件?
如果是这样,您可以创建一个启动您的文件的 Adobe AIR 应用程序。让用户在其计算机上安装该 AIR 应用程序。接下来,创建一个小的 Flash 小部件以放置在您的网页上。让 Flash 小部件调用 AIR 应用程序。
一些API信息:
http://www.rogue-development.com/blog2/2008/03/interacting-with-an-air-app-from-a-browser-based-app/
Do you have the ability to install software on the computer you wish to run the executable on?
If so, you can create an Adobe AIR application that launches your file. Have the user install that AIR app on their computer. Next, create a small flash widget to sit on your web page. Have the flash widget invoke the AIR app.
Some API info:
http://www.rogue-development.com/blog2/2008/03/interacting-with-an-air-app-from-a-browser-based-app/
运行本地文件需要将对象嵌入到可以访问本地计算机的页面中。这可以通过构建 ActiveX 控件或 java 小程序来实现。对于公共网站等来说,这通常会令人皱眉,但对于本地网络或受控环境来说却完全没问题。
Running local files will require embedding an object in a page that has access to the local machine. This is achievable by building an ActiveX control or java applet. This is generally frowned apon for public websites etc but perfectly fine for a local network or controlled environment.
客户端不能运行exe,否则是安全漏洞。
不过,您可以通过 CGI 在 Windows 服务器上运行 exe。
It is impossible to run exe on client, otherwise it is security hole.
You may run exe on windows server through CGI, though.
我通过链接到运行 .exe 本身的 .bat 文件来完成此操作。
I do it by linking to a .bat file that runs the .exe itself.