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 ...
随机推荐
- Linux nginx 配置 location 语法 正则表达式
location语法:location [=|~|~*|^~] /uri/ { - }默认:否上下文:server这个指令随URL不同而接受不同的结构.你可以配置使用常规字符串和正则表达式.如果使用正 ...
- linux下安装zookeeper(单机版)
Zookeeper 分布式服务框架是用来解决分布式应用中经常遇到的一些数据管理问题,如:统一命名服务.状态同步服务.集群管理.分布式应用配置项的管理等.本文主要从使用者角度来介绍一下Zookeeper ...
- 模拟退火解决TSP问题
// monituihuo.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <stdio.h> #includ ...
- python学习笔记-(五)字符串&字典
1.字符串操作 >>> name = ("my name is cc")#首字母大写 >>> print(name.capitalize()) ...
- js随机生成N位数
function RondomPass(number){ var arr = new Array; "); ;i<number;i++){ ); arr[i] =arr1[n] ; / ...
- Aspect Oriented Programming using Interceptors within Castle Windsor and ABP Framework AOP
http://www.codeproject.com/Articles/1080517/Aspect-Oriented-Programming-using-Interceptors-wit Downl ...
- 使用EntityFramework6.1的DbCommandInterceptor拦截生成的SQL语句
开始 EF6.1也出来不少日子了,6.1相比6.0有个很大的特点就是新增了System.Data.Entity.Infrastructure.Interception 命名空间,此命名空间下的对象可以 ...
- Python之路【第三篇】:Python基础(二)
函数的理解 面向过程:根据业务逻辑从上到下写垒代码 函数式:将某功能代码封装到函数中,日后便无需重复编写,仅调用函数即可 函数作用是你的程序有良好的扩展性.复用性. 同样的功能要是用3次以上的话就建议 ...
- Last-Modify和Etag
Last-Modified和Etag Last-Modified是页面文件最后的修改时间,Etag相当于页面文件的hash. http request http respose If ...
- Python开发【第十七篇】:MySQL(一)
一.概述 1.什么是数据库 ? 答:数据的仓库,如:在ATM的示例中我们创建了一个 db 目录,称其为数据库 2.什么是 MySQL.Oracle.SQLite.Access.MS SQL Serve ...