Vinay
Vinay

Reputation: 183

Executing shell commands on linux using javascript

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

Answers (3)

Otar
Otar

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

Daniel Vassallo
Daniel Vassallo

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

Quamis
Quamis

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

Related Questions