0

I need to understand if Firefox (or IE) supports starting an external operating system (Windows) process from JavaScript code running in a <script> tag in the web page. As a trivial example, I want the user to be able to click a button (<input type="button" .../>) in the web page which would cause some JavaScript to be executed that would start Notepad (i.e. c:\Windows\System32\notepad.exe) (Note: in my case, I need to start a custom .exe created by one of the developers I work with, not Notepad.)

My belief is that this is likely impossible, since it would obviously pose an extreme security risk. (e.g. You load my evil web page, my page runs some JavaScript which runs an external Windows process to delete your file-system). Perhaps there is a way to get around this, and still maintain a secure environment in the browser?

The additional minor complexity is that I need to be able to pass command line parameters to the process when it starts.

StvnBrkdll
  • 3,924
  • 1
  • 24
  • 31
  • Internet Explorer allows for integration with downloaded native code, but not Firefox. And obviously a client connecting from an Android or iOS tablet or from any non-Windows machine would face a fundamental barrier too. This really isn't what the web is for. – Pointy Mar 12 '15 at 15:15
  • Thank you for your response Pointy, it is helpful. In my case, I don't have the luxury of taking the purist's perspective (i.e. "that isn't what the web is for"). My employer, who ultimately pays my bills, has asked for a solution to the problem I pose above. Because the environment that my web app runs in is highly constrained, I have the luxury of only targeting IE and Firefox on the Windows desktop. – StvnBrkdll Mar 12 '15 at 17:40

1 Answers1

1

You could write a custom Protocol that handles a request from the browser opening some kind of program in the OS. Something like the mailto://youremail@gmail.com works.

I'm not an expert at it but you can check this Out.

https://msdn.microsoft.com/en-us/library/aa767914(v=vs.85).aspx

Also this answer...

how do I create my own URL protocol? (e.g. so://...)

Community
  • 1
  • 1
  • PS. this could be a Pain for Mobile Devices. – Cesar Alvarado Mar 12 '15 at 15:44
  • Thank you for your response Cesar. I have been reading the links you posted, and other related links, and it looks like this could be a viable solution to my problem. I'll post more info. as I make progress. I should note that in my original problem statement, I indicated that I needed to start the Windows process via JavaScript code. However your proposed solution does not require any JavaScript, but *may* still solve my problem. – StvnBrkdll Mar 12 '15 at 17:42