最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Run exe file from Javascript - Stack Overflow

programmeradmin0浏览0评论

How can I run exe file from Mozilla Filrefox?

I tried this but it not working.

 var  oShell = new ActiveXObject("Shell.Application");
 var andtoRun = "C:\\Buziol Games\\Mario Forever\\Mario Forever.exe";
 oShell.ShellExecute(andtoRun,"","","open","1");

How can I run exe file from Mozilla Filrefox?

I tried this but it not working.

 var  oShell = new ActiveXObject("Shell.Application");
 var andtoRun = "C:\\Buziol Games\\Mario Forever\\Mario Forever.exe";
 oShell.ShellExecute(andtoRun,"","","open","1");
Share Improve this question asked Jul 9, 2015 at 8:27 SobirSobir 891 silver badge10 bronze badges 3
  • are you sure the path to file is right? You have spaces in it - this always makes problems :) – areim Commented Jul 9, 2015 at 8:31
  • 1 You can't use ActiveXObject in Firefox, it's an IE-only technology and has been removed pletely in Edge. – Karl-Johan Sjögren Commented Jul 9, 2015 at 8:48
  • if you have a website that needs to access an exe file, it is generally done by introducing a client app that runs a localhost application – Neville Nazerane Commented Sep 14, 2018 at 20:13
Add a ment  | 

2 Answers 2

Reset to default 3

You can't run any system mand from a web page. This was only possible with Internet Explorer under certain conditions, but fortunately it's not something you can do with modern browsers.

Perhaps your path isn't right. It could be produced by whitheSpaces.

You can solve it by quoting folder names wich contains whitespaces, like this.

 var  oShell = new ActiveXObject("Shell.Application");
 var andtoRun = "C:\\'Buziol Games'\\'Mario Forever'\\'Mario Forever.exe'";
 oShell.ShellExecute(andtoRun,"","","open","1");

If ActiveXObject not works on firefox, you can use window.open function.

window.open('file:///C:"Buziol Games"/"Mario Forever"/"Mario Forever.exe"');
发布评论

评论列表(0)

  1. 暂无评论