开发者

I want to open a program by JavaScript on the clients computer? (WScript.shell)

开发者 https://www.devze.com 2023-01-30 06:55 出处:网络
I tried to open a program using this code: <head> <title></title> &l开发者_如何学编程t;script language="javascript" type="text/javascript">

I tried to open a program using this code:

<head>
<title></title>
&l开发者_如何学编程t;script language="javascript" type="text/javascript">
    function run() {
        var shell = new ActiveXObject("WScript.shell");
        if (shell) {
            shell.run('"C:\\Program Files (x86)\\BitTorrent\\BitTorrent.exe"', 1);
        }
        else
        { alert("BitTorrent is not installed on your system."); }
    }
</script>
</head>
<body onload="run()">

</body>
</html>

But it doesn't work. Any help, please?


It is because browser block creation of ActiveX controls, for security reasons. Moreover, ActiveX is supported only in IE; IE has options to allow run ActiveX in browser, but I have doubts that many users have this feature enabled.


Why would you want to open BitTorrent anyways? I believe you can achieve the desired effect using magnet links

PD: Check their developers page

Update: I'm not sure if this is "legal" here, or considered "spam", if it easy please remove it, but here's a link to a site that implements magnet links to achieve what I think you might want to be doing: eztv.it. Check their

I want to open a program by JavaScript on the clients computer? (WScript.shell)


Check your browsers' configuration, it may block ActiveX.

Do you get any error message ?

0

精彩评论

暂无评论...
验证码 换一张
取 消