It's not a secret anymore!
The moose likes HTML, CSS and JavaScript and the fly likes How to call an exe from Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to call an exe from Javascript" Watch "How to call an exe from Javascript" New topic

How to call an exe from Javascript


Joined: Aug 13, 2001
Posts: 1
How do I call an exe on the local machine / on Web Server from JavaScript ?
My requirement is ....
I have a textbox in the HTML form where in I will have a file with pathname (Ex : If Local machine - C:/Test.doc ; If web server than http://webservername/virtualdirectoryname/test.doc )
When I click "Open File" button the file selected in the textbox should be opened in the appropriate editor.Means Test.doc should be opened in MS-WORD and not in browser window.
I should be able to open applications which does not support ActiveXObjects also and it must also work for applications for which no object can be created .
We also have editors that are very specific -- in order to display the results of chromatography, XRF, etc because the results are mostly stored in a binary format and only viewable via software of the instrument supplier (sometimes even instrument type en version specific).
And one more question is : Suppose the client doesn't have the required software/editor to open the file than can we call the software/editor exe from webserver and open the file in that exe ?
Can this be done using Javascript ?
I am trying it with .......

xavier romea
Ranch Hand

Joined: Jun 28, 2001
Posts: 37
I'm afraid you cannot call an exe by a javascript function.
When netscape loads a file, netscape looks for the file extension in the preferences -> Navigator -> Applications (quite similar to the base register in Windows) and asks the user if he wants to download the file onto the hard drive or open it with the application (plugin or standalone software) netscape has found in the preferred applications.
santosh nd

Joined: Jul 31, 2001
Posts: 4
hi india(Vinitha),
i think u cannot execute an exe using javascript,but can be done in html using exec command...< ONCLICK="exec('ur exe file'); return false;"
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4351

I hate to say this but, your name does not comply with the Javaranch naming guidelines which can be found at
please register again with a valid name.

Visit my download page
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
Actually, this can be done. The problem is that it involves exploiting security vulnerabilities, which are subject to radical change from browser to browser, version to version. It also raises some legal concerns.
subject: How to call an exe from Javascript
It's not a secret anymore!