3

I know how to run an .exe using ActiveX, but that is Internet Explorer only, and I also know how with .hta, but that has to be installed/used as an application.

This doesn't have to be online: actually I'd prefer this locally.

This doesn't have to work with all browsers: the solution could would only with Firefox.

Thank you a lot in advance! :)

  • 2
    you comment about .hta is windows only, but .exe is windows only. – kennypu Jan 18 '13 at 01:17
  • @kennypu sorry. :) I mean't that it has to be installed as an application. :) I just edited my question to fix this illogical moment. :) –  Jan 18 '13 at 01:18
  • I'm assuming the downvote is because you are asking how to do something that is considered highly unethical by most web developers. – Alex Wayne Jan 18 '13 at 01:21
  • @AlexWayne I woudn't be doing this from my website. I'm just curious if this could be accomplished locally, with prompting. I would NOT do this on any public-facing site. –  Jan 18 '13 at 01:24
  • Personally I suspect that it was because the title says "cross-browser" while the text says "firefox" – Jeff Jan 18 '13 at 01:26
  • @Jeff cross-browser would be great, but Firefox would also suffice, as I explained in my question. –  Jan 18 '13 at 01:27
  • it's not very cross-browser if it only works on windows :) – Eevee Jan 18 '13 at 02:25
  • @Eevee lol you know what I mean. :) –  Jan 18 '13 at 03:00

1 Answers1

2

It looks like you can run a .exe from Firefox using nsIProccess https://developer.mozilla.org/en-US/docs/Code_snippets/Running_applications so you should look into that.

however, it is not advisable to run a .exe from browser, as this can make your site look malicious.

I couldn't find anyway for chrome. however, you can load external libraries using the NPAPI, this may work for exe as well but I have no clue: http://developer.chrome.com/extensions/npapi.html

kennypu
  • 5,950
  • 2
  • 22
  • 28
  • I wouldn't be doing this from my website. I'm just curious if this could be accomplished locally, with prompting. And your answer explained that. :) I would never do this in any public-facing site. –  Jan 18 '13 at 01:23
  • Thanks. I'm going to accept your answer. :) Didn't know that this was possible. :D But one thing- just curious- this is locally right? Also, is there any similar technique for Chrome? –  Jan 18 '13 at 01:30
  • I couldn't find anyway for chrome. however, you can load external libraries using the NPAPI, this may work for exe as well but I have no clue: http://developer.chrome.com/extensions/npapi.html – kennypu Jan 18 '13 at 01:38
  • _+1 and accept_ Wow thanks a lot! :) Could you maybe edit you answer to also include the Chrome solution please? Thanks. :) –  Jan 18 '13 at 01:40
  • The links in this answer are now broken, but I found another solution, using a [custom URL protocol](https://stackoverflow.com/questions/80650/how-do-i-register-a-custom-url-protocol-in-windows) to run an `.exe` from the browser. – Anderson Green May 24 '22 at 01:14