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 ...
随机推荐
- Mysql配置项的简单优化
preface 众所周知,Mysql已经成为广泛使用的开源数据库了,so 公司阿里云的数据库为Mysql,在最开始的时候是直接yum安装,配置项都是默认的,没有任何调整,这次有时间就参考各路大神的资料 ...
- 高可用与负载均衡(1)之linux系统的数据链路层负载均衡
preface 在蓝厂就职到时候,每台缓存服务器都能够跑到2G的流量,这么大的流量,有人会问,服务器是不是安装的万兆网卡,no no no,仅仅是3张千兆网卡绑定在一块.万兆网卡的服务器少见,大多数都 ...
- spring boot 框架 启动更新项目,以及生成 "实体_"文件
1.更新项目 clean ---> 更新项目 ---> package--->refresh 即可.(这几个步骤一个不能够少) 2.项目中的类的依赖关系存在,但是无法导入依赖 m ...
- url下载网页的三种方法
# -*- coding: utf-8 -*- import cookielib import urllib2 url = "http://www.baidu.com" print ...
- Java——URL和URLConnection
使用URL读取内容 import java.awt.im.InputContext; import java.io.InputStream; import java.net.MalformedURLE ...
- RandomAccessFile类
File类只是针对文件本身进行操作,而如果要对文件内容进行操作,则可以使用RandomAccessFile类,此类属于随机读取类,可以随机地读取一个文件中指定位置的数据. //============ ...
- Unity Serialization
http://forum.unity3d.com/threads/serialization-best-practices-megapost.155352/ http://docs.unity3d.c ...
- 替换所有的cell的右侧箭头
写个UITableViewCell的分类重写这个方法 - (void)didMoveToSuperview { [super didMoveToSuperview]; // 全局替换右侧箭头 if ( ...
- JS 语言的Function 解析
1.最基本的作为一个本本分分的函数声明使用. 复制代码代码如下: function func(){} 或 var func=function(){}; 2.作为一个类构造器使用: 复制代码代码如下: ...
- 百度编辑器修改,不让它自动替换html标签
在ueditor.all.js中找到 UE.plugins['defaultfilter'] = function () 注释或删掉这块代码. 注:ueditor.all.min.js 中也一样,格式 ...