js网页中调用本地应用程序
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test ActiveXObject</title>
<script>
function Run(command) {
window.oldOnError = window.onerror;
window._command = command;
window.onerror = function (err) {
if (err.indexOf('utomation') != -1) {
alert('命令' + window._command + ' 已经被用户禁止!');
return true;
}
else return false;
};
var wsh = new ActiveXObject('WScript.Shell');
if (wsh)
wsh.Run(command);
window.onerror = window.oldOnError;
}
</script>
</head>
<body>
<h1 align="center">网页中调用本地应用程序</h1>
请输入要运行的程序:<br/><input name=exe type=text size=20 value="regedit">
<button class=button onclick="Run(exe.value)">确定</button>
<button class=button onclick=exe.value="";>重新输入</button><br/>
<button class=button onclick="Run('notepad')">记事本</button><br/>
<button class=button onclick="Run('mspaint')">画图板</button><br/>
<button class=button onclick="Run('calc')">计算器</button><br/>
<button class=button onclick="Run('cmd')">cmd</button><br/>
<button class=button onclick="Run('Regedit')">regedit</button><br/>
<button class=button onclick="Run('Msconfig')">msconfig</button><br/>
<button class=button onclick="Run('file:///D:/Program%20Files/Winamp/WINAMP.EXE')">winamp</button><br/>
<button class=button onclick="Run('IEXPLORE.EXE')">IE</button><br/>
<button class=button onclick="Run('..')">..</button><br/>
<button class=button onclick="Run('%windir%')">%windir%</button><br/>
<button class=button onclick="Run('%temp%')">%temp%</button><br/>
<button class=button onclick="Run('file:///D:/Program%20Files/Tencent/qq.EXE')">winamp</button>
</body>
</html>
js网页中调用本地应用程序的更多相关文章
- PC网页js调用本地应用程序
最近要现实一个在PC网页中实现点击按钮调用本地应用程序的功能 其实实现原理也非常简单, 首先注册一个本地注册表文件,指向本地应用程序路径 其次在网页中用js指向这个注册表文件,就可以实现网页调用本地应 ...
- 【iOS】网页中调用JS与JS注入
非常多应用为了节约成本,做出同一时候在Android与iOS上都能使用的界面,这时就要使用WebView来做.Android和IOS上都有WebView,做起来非常省事.当然这时就要考虑怎样在Andr ...
- html网页调用本地exe程序的实现方法:
html网页调用本地exe程序的实现方法:1.新建注册表具体文件: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\hhtpexe] [ ...
- ubuntu下浏览器调用本地应用程序
ubunut下浏览器调用本地应用程序需要desktop文件和scheme协议的支持,和windows 的url protocol类似,只是注册协议的方式不一样. 首先是desktop文件,里面需要加入 ...
- Android 中调用本地命令
Android 中调用本地命令 通常来说,在 Android 中调用本地的命令的话,一般有以下 3 种情况: 调用下也就得了,不管输出的信息,比如:echo Hello World.通常来说,这种命令 ...
- [转]VC中调用外部exe程序方式
本文转自:http://blog.sina.com.cn/s/blog_486285690100ljwu.html 目前知道三种方式:WinExec,ShellExecute ,CreateProce ...
- C语言中调用运行python程序
C语言中调用运行python程序: Python代码如下: 创建test.py. #!/usr/bin/python3 #test.py import sys x = ]) print x*x 注意: ...
- Js如何调用本地应用程序
一般情况下,浏览器中是无法直接和本机的其他的程序进行交互的,在IE中,我们可以通过ActiveX对象的方式进行.但是这个方式只适用于IE浏览器,另一种比较通用的方式便是URL协议的方式,我们将某种UR ...
- PHP 网页调用本地exe程序实例
一.需求:在做网站的时候,有些网站网页面需要调用本地的exe程序. 二.方法:利用注册URL Protocol的方式. 代码如下: 1.视图文件里面的代码: <a href="fyex ...
随机推荐
- 关于input/textarea提交内容空格回车转换问题,以及ng-model去除空格问题
input/textarea提交内容空格回车转换问题 /*my-enter-bind.js*/ /*回车换行显示转义*/ 'use strict'; angular.module('app') .di ...
- JAVA jdbc获取数据库连接
JDBC获取数据库连接的帮助类 import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManage ...
- Linux Canbus调试笔记
STM32之CAN---错误管理分析 牛人博客 http://blog.csdn.net/flydream0/article/details/8161418 CAN总线在嵌入式Linux下驱 ...
- bigdecimal类型数据的min方法
java.math.BigDecimal.min(BigDecimal val) 返回此BigDecimal和val的最小值. 声明 以下是java.math.BigDecimal.min()方法的声 ...
- firefox怎么修改tls协议号
如果目前正在运行火狐26,你可能已经注意到,浏览器仅支持SSL 3.0和TLS 1.0,默认不开启TLS 1.1或TLS 1.2.另外我们知道Firefox 27 已经实现了对TLS 1.2的支持. ...
- 脚本放在 <body> 元素的底部
建议把脚本放在 <body> 元素的底部. 这会提高网页加载速度,因为 HTML 加载不受制于脚本加载.
- Java——单选按钮:JRadioButton
import java.awt.Container; import java.awt.GridLayout; import java.awt.event.WindowAdapter; import j ...
- ecshop 后台-》广告
1.后台广告宽度限制不能超过1024,高度大于1,admin/ad_position.php 第236行 || $ad_width < ) { make_json_error($_LANG['w ...
- php 下载文件的函数
通过函数完成下载文件的PHP功能代码 function download($url, $filename) { // 获得文件大小, 防止超过2G的文件, 用sprintf来读 $filesize = ...
- Spring Ioc--Bean装配
继前一篇IoC概述.Spring容器总结,接下来总结下Bean的装配过程. 要使引用程序中的Spring容器成功启动,需要同时具备以下3个条件: 1.Spring框架的类包,放在应用程序的类路径下. ...