prabhakaran
prabhakaran

Reputation: 5274

How to run this ActiveX based javascript in Firefox

I am trying to run the below code which launches notepad. IE tab is nice solution, but loading is slow. I gave the try to ff-activex-host.I downloaded the binary exe. I copied the npffax.dll to firefox plugin folder(C:\Program Files\Mozilla Firefox\plugins) . But, still the above code is not working. I am getting the message "ActiveXObject is not defined" in web console. Can anybody shed a light on this issue?. Please clear me of running this code. This is the code I am trying.

var commandtoRun ="C:\\WINDOWS\\notepad.exe";
var oShell = new ActiveXObject("WScript.Shell");
oShell.run(commandtoRun);

EDIT: Any suggestion to run the above code in firefox is welcomed.

Upvotes: 0

Views: 5969

Answers (1)

c69
c69

Reputation: 21497

Here is sample code from MDN:

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

Keep in mind, this is not cross-browser and will not work on Linux. If this is critical for you, - use nsIProcess interface, https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIProcess

Upvotes: 1

Related Questions