HTML is not a programming language. It is not with HTML that this is possible, but with scripting languages like Javascript and Vbscript.
With no language can you do it from a browser. The reason is security. If it were possible to run programs arbitrarily on the client machine, it would not be difficult for a hacker to force the download of malicious code to be compiled and run on his machine. At the very least you could get all the passwords stored on your computer, and in the worst case you would give access to your bank accounts to an unknown.
Windows has an executable called Wscript.exe. I will leave it to anyone who is curious to find it. This executable is capable of running Javascript locally, with administrator permissions. The environment is different from the browser - you won’t have access to many things, like Web Storage. In compensation objects such as the ShellObject
become accessible, and you can even manipulate files.
I’m not an expert on Node.js
, but as it is a server and not client environment, you are able to access more operating system resources with it than via browser, in a way. But I’m not sure if he’s able to access the ShellObject
.
In addition to Node and Wscript, there are several other Javascript environments that allow sift through other people’s machines and destroy files access operating system components in a less restricted way than via browser. It is only a matter of searching.
Now, if the intention was really to access the shell by browser... Instead of Javascript use components WITH or Activex. And understand that this will probably only work in Internet Explorer, version 6 or lower. Good luck.
In what environment is this code running? The
ShellObject
is specific to Microsoft, and I understood intended to be embedded in Visual Basic programs. There is no support forShellObject
in the browser. Security reasons... Even HTML5 - which offers multiple integration options with your environment - hasn’t gone so far as to allow access to the shell (as far as I know). Maybe you get something like this with a Java applet (Trusted), but I’m not sure.– mgibsonbr