Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

This page describes how to run other programs from your chrome JavaScript code, using Mozilla XPCOM interfaces. There are two ways to run programs.

Using nsIProcess

The recommended way is to use the nsIProcess interface because it is crossplatform.

Using nsILocalFile.launch()

This method is not implemented on all platforms, especially not on Unix/Linux! See nsILocalFile.launch() for details and make sure that all your target platforms support this method!

This method has the same effect as if you double-clicked the file, so for executable files—it will just run the file without any parameters.

For more information on nsIFile/nsILocalFile, see File I/O.

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

References

Document Tags and Contributors

 Last updated by: wbamberg,