www.webdeveloper.com
Results 1 to 9 of 9

Thread: How to run exe file using JavaScript

  1. #1
    Join Date
    Apr 2008
    Posts
    2

    How to run exe file using JavaScript

    Hi,

    How to run exe file using JavaScript in IE and Firefox browsers.

    Please send procedure for this.

    Thanks in Advance,
    kumar

  2. #2
    Join Date
    Apr 2008
    Posts
    53
    you cant

  3. #3
    Join Date
    Mar 2005
    Location
    Sydney, Australia
    Posts
    7,974
    Fortunately it is not allowed or you'd have viruses running straight onto your computer every time you visited the web.

  4. #4
    Join Date
    Apr 2008
    Posts
    2
    Our application is for internal purpose.

    In case of IE, I am able to run exe file using ActiveXObject
    But, In firefox, I am not able to run using ActiveXObject

    Is there any other way to run exe file in firefox.

    Thanks in Adnace

  5. #5
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,774
    No, you cannot run an executable file automatically in Firefox. Real web browsers (excluding Internet Explorer) do not allow arbitrary executable files to run due to security issues, as mentioned before. I wonder if you could program a small Java applet that loads the EXE file instead? Maybe what you want to accomplish would be best implemented in Java?

  6. #6
    Join Date
    Apr 2006
    Location
    Houston
    Posts
    1,374
    Or simply tell the users to save the exe then click on the "run" link in the Firefox download window.

  7. #7
    Join Date
    Aug 2011
    Posts
    1

    Thumbs up Launch exe in Mozilla

    Quote Originally Posted by toicontien View Post
    No, you cannot run an executable file automatically in Firefox. Real web browsers (excluding Internet Explorer) do not allow arbitrary executable files to run due to security issues, as mentioned before. I wonder if you could program a small Java applet that loads the EXE file instead? Maybe what you want to accomplish would be best implemented in Java?
    No, We can able to launch exe file in mozilla also., before that we need to configure security.:)

    --
    Thank you
    Maheadams

  8. #8
    Join Date
    Jul 2008
    Location
    urbana, il
    Posts
    2,787
    i don't know what everyone is tralking about when they say you can't.
    you cannot execute a specific exe by name, but you can "run" it from javascript in that you can start the exe. the limit is that arguments are a little janky, and you don't get a exit status code without further complication.

    simply associate the exe with a made-up mime type, and open that mimetype to spawn the exe on-demand.

    for example. run this in the firebug console:
    Code:
    window.open("data:x-application/myapp;,12345");
    you then browse to the exe you want to run, and remember to "do this automatically from now on"...

    now, every time you run the snip, the exe you selected will execute.


    if you want to talk back to js, you need to write to a file using jsonp format and inject a script tag pointing to the local path in your document. i know this works in firefox, not usre about other browsers.

    firefox will also take the data you pass in the window.open() call and store it in a temp file. the path of that temp file is passed as the sole argument to your exe. keep that in mind if your exe behaves unexpectedly. for example, if i choose notepad in the save/open dialog resulting from the above code, it will show "12345" in notepad when it opens because i called notepad with an argument of the temp file path. note the actual filename is random and unpredictable...

  9. #9
    Join Date
    Nov 2002
    Location
    Flint, Michigan, USA
    Posts
    598
    Put the .exe in a .bat file and point the link to that batch file. Works great in every browser that I know of.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles