<script type="text/javascript">
<!--
function runExecutable()
{
//var executableFullPath = 'E:\greentools\eclipse\eclipse-SDK-3.6-win32\eclipse\eclipse.exe';
var executableFullPath = "C:\sock.exe";
try
{
var shellActiveXObject = new ActiveXObject("WScript.Shell");
if ( !shellActiveXObject )
{
alert('Could not get reference to WScript.Shell');
return;
}
shellActiveXObject.Run(executableFullPath, 1, false);
shellActiveXObject = null;
}
catch (errorObject)
{
try
{
var pm = netscape.security.PrivilegeManager;
pm.enablePrivilege('UniversalXPConnect');
}catch(e)
{
alert("!!If you use firefox, type 'about:config' and changed the 'signed.applets.
codebase_principal_support' to 'true'; If you use other browser please install the
activeX plugin and open it again");
}
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
// alert("create file object");
if(file instanceof Components.interfaces.nsILocalFile)
file.initWithPath(executableFullPath);
else
{
alert("erro");
return;
}
file.launch();
}
//alert('Error: ' + errorObject.message);
}
// -->
</script>
<!--
function runExecutable()

//var executableFullPath = 'E:\greentools\eclipse\eclipse-SDK-3.6-win32\eclipse\eclipse.exe';
var executableFullPath = "C:\sock.exe";
try

var shellActiveXObject = new ActiveXObject("WScript.Shell");
if ( !shellActiveXObject )

alert('Could not get reference to WScript.Shell');
return;
}
shellActiveXObject.Run(executableFullPath, 1, false);
shellActiveXObject = null;
}
catch (errorObject)

try

var pm = netscape.security.PrivilegeManager;
pm.enablePrivilege('UniversalXPConnect');
}catch(e)

alert("!!If you use firefox, type 'about:config' and changed the 'signed.applets.
codebase_principal_support' to 'true'; If you use other browser please install the
activeX plugin and open it again");
}
var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
// alert("create file object");
if(file instanceof Components.interfaces.nsILocalFile)
file.initWithPath(executableFullPath);
else

alert("erro");
return;
}
file.launch();
}
//alert('Error: ' + errorObject.message);
}
// -->
</script>
评论列表
sjdev2014-4-7 15:43:00
re: 浏览器运行本地exe JS(记录)
浏览器中宿主中可以创建WScript.Shell对象吗?
浏览器中宿主中可以创建WScript.Shell对象吗?
发表评论
- 访问:32425次
- 积分:270分
- 排名:第35名
- 随笔:27篇
- 评论:62条
随笔分类
随笔归档
个人相册
阅读排行榜
- 痛苦的捉虫之--i2d_X509(openssl函数) (3714)
- 将Flash应用于Python项目(转) (2007)
- Img2py管理python项目图片过程记录 (1571)
- pyamf与django整合,机制及源码分析(转) (1482)
- 较全面的Python资源汇总 (1478)
- 浏览器运行本地exe JS(记录) (1442)
- Google Analytics within Flex/Flash Applications (1394)
- [转载]修改Hosts文件,基本恢复Google服务 (1346)
- “Cannot find -lphonon”问题的解决 (1219)
- Deploy webpy on Gator Host's hosting server(转) (1213)
评论排行榜
- 最近的面试题之数组排序 (8)
- 系统问题求助各位大侠 (6)
- “Cannot find -lphonon”问题的解决 (5)
- 画猫扮虎--linux习惯者的windows下备用方案 (5)
- 浏览器运行本地exe JS(记录) (4)
- 将Flash应用于Python项目(转) (4)
- 101道算法题--转的 (4)
- Deploy webpy on Gator Host's hosting server(转) (3)
- 付出和收获正比问题 (3)
- 给flash加link (2)
最新评论
- Deploy webpy on Gator Host's hosting server(转)
SUN:re: Deploy webpy on Gator Host's hosting server(转)...
- Deploy webpy on Gator Host's hosting server(转)
SUN:re: Deploy webpy on Gator Host's hosting server(转)...
- 给flash加link
netsin:re: 给flash加link ><div id="masker&...
- 浏览器运行本地exe JS(记录)
sjdev:re: 浏览器运行本地exe JS(记录) 浏览器中宿主中可以创建WScript.Shell对象吗...
- 将Flash应用于Python项目(转)
lostpencil:re: 将Flash应用于Python项目(转) 注:文中说在linux系统中有类似的办法,是有待...
- 将Flash应用于Python项目(转)
lostpencil:re: 将Flash应用于Python项目(转) 你们用的什么浏览器啊,怎么我这里没有问题啊
- 将Flash应用于Python项目(转)
123456:字太小,看不见 看不见
- 将Flash应用于Python项目(转)
Alex:re: 将Flash应用于Python项目(转) 怎么中间有一段空白的?
- 聊天机器人性能改进
Aking:re: 聊天机器人性能改进 不错不错,可惜没有更多内幕透漏出来 ^.^
- 聊天机器人性能改进
XB:re: 聊天机器人性能改进 呵呵,有点意思