views:

115

answers:

3

Hi All,

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

+1  A: 

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:)

Quamis
Is their any way by which i can run commands at client other than using activeX object.
Vinay
well, one of the "features" of the web browser is to protect the user from getting "raped" by a malicious web page:) So..no. You may try and exploit IE6's bug though:)
Quamis
+3  A: 

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.

Daniel Vassallo
A: 

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...

Otar
can i do it by using servlets too...?
Vinay
nope, it cant do that
Quamis
This would not execute a command at the **client**.
Pointy