How to run a local exe in my firefox extension?

16,962

Since you've explicitly asked for an .exe then you can use nsILocalFile.launch(): https://developer.mozilla.org/en/Code_snippets/Running_applications

var file = Components.classes["@mozilla.org/file/local;1"]
                     .createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("c:\\myapp.exe");
file.launch();

If you wanted to make it cross-platform you should look into nsIProcess

Share:
16,962
jin
Author by

jin

Updated on June 12, 2022

Comments

  • jin
    jin almost 2 years

    I want to run a local exe in my firefox extension javascript file, but ActiveXObject("WScript.Shell") is work fine in IE,not in FF,how to run a local exe in js in firefox.

  • daveloyall
    daveloyall over 9 years
    Wouldn't that let ANY webpage invoke arbitrary executables?
  • McK
    McK almost 8 years
    You should not just paste a link, but summarize the content. If the link is broken in the future, your whole answer doesn't have any value any more.
  • Yohanim
    Yohanim over 7 years
    Components.classes is not accessible via JavaScript running in a webpage, it is only accessible via JavaScript running in a Firefox extension
  • pawel
    pawel over 7 years
    @NPE which is precisely the use case described in the question, isn't it?
  • Anderson Green
    Anderson Green almost 2 years
    The link in this answer is now broken.