从网页启动 Windows 中的应用程序
我正在工作中开发一个基于网络的应用程序,以使每一次的生活变得更轻松。我正在尝试构建一个页面,使他们能够在浏览器中启动应用程序。我想我可以使用Windows Script Host Run Method,但我从未使用过任何基于Windows的脚本语言。因此,总结一下我的问题,我需要单击浏览器中的启动按钮来启动 Windows 上的文本板或其他程序。任何帮助将不胜感激。
谢谢
更新问题
这是一个可能的答案,
<script language="javascript" type="text/javascript">
function runApp(){
var shell = new ActiveXObject("WScript.shell");
shell.run("notepad.exe", 1, True);
}
</script>
<input type="button" name="button1" value="Run Notepad" onClick="runApp()" />
I am working on a web based application at my work to make every once life easier. I am trying to build a page that would enable them launch the apps from with in the browser. I was thinking I could use Windows Script Host Run Method, but I have never used any windows based scripting languages. So to sum up my issue here, I need to click on a launch button with in the browser to launch text pad or other programs on Windows. Any help would be very appreciated.
Thanks
Update to question
Here is a possible answer,
<script language="javascript" type="text/javascript">
function runApp(){
var shell = new ActiveXObject("WScript.shell");
shell.run("notepad.exe", 1, True);
}
</script>
<input type="button" name="button1" value="Run Notepad" onClick="runApp()" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使其合法运行的唯一方法是让您的用户在您的网站尝试启动该程序之前安装该程序。您的安装将注册一个 URL Protocol 。当 Web 浏览器看到非 http 类型协议时,它将尝试加载接受您网站请求的 URL 协议的注册程序。
将应用程序注册到 URL 协议
The only way for this to work legitimately is to have your users install a program prior to your website attempting to launch the program. Your installation will register a URL Protocol . When the Web Browser sees a non-http type protocol it will attempt to load the registered program that accepts the URL protocol your website is requesting.
Registering an Application to a URL Protocol
您可以在 HTML 页面上将 href 添加到本地或 UNC 路径。
you could do an href on your HTML page to a local or UNC path.