Reputation: 183
I have a scenario in my webapp where i want to execute some shell command on the client , so is their any way i can achieve this using javascript. Their is a method "exec" in php but i think that will execute command at the server end.
Thanks in Advance, Vinay
Upvotes: 1
Views: 2643
Reputation: 2591
JavaScript can not do that but you can call server-side script, PHP for example, using Ajax request and pass command to it as a parameter, PHP script would retrieve the command and execute with exec()
function.
P.S. bad practice...
Upvotes: -1
Reputation: 344301
No, JavaScript does not have access to the client machine, and certainly cannot execute shell commands. While this may be unfortunate for your genuine requirement, this is an important limitation for obvious security reasons.
Upvotes: 3
Reputation: 11077
No, javascript cannot execute a command on the client-side. You could probably use an activeX control or a custom extension for Firefox... but its complicated:)
Upvotes: 1