Javascript to open an application

I just start learning javascript and sorry if the question seem basic.

In DOS, if I write a batch file it would be START notepad.exe. This will launch the notepad application. How do you launch an application in Javascript?


Do you realise what a security hole this would be if it were allowed?! :eek:

I could write a JavaScript that launched your email application to send me all the interesting things on your hard drive – like passwords, bank account information, etc.

In Internet Explorer you can achieve this to some degree, using ActiveX objects. But other browsers don’t even let you try.

Technically it can be done in other browsers if you install something to handle a different protocol, like this. But of course that is only useful on things like intranets, internet cafes and such things.

I’m only using this on my local host and not on the internet. I tried something like this, it works for notepad or calc which are built in MS.

var WshShell = new ActiveXObject("WScript.Shell");

It does not work if I launch a non built in MS application.

var WshShell = new ActiveXObject("WScript.Shell");

Any comments or suggestions is greatly

Those JScript commands will only work on Internet Explorer because there is no JavaScript equivalent commands. Those are intended purely for use on company intanets and can’t be used on the web.

Remember that the ‘\’ character is an escape character within strings. If you want a literal backslash you must enter it twice. Try.

var WshShell = new ActiveXObject("WScript.Shell");

thank you AutisticCuckoo, it works!!!:slight_smile: