executing shell scripts in javascript or trigger s

2020-05-06 11:29发布

问题:

I have one shell script for scanning documents from scanner(hardware).

Shell scripts were stored in each client system.

Suppose client scans application means i have to run that shell script and store scanned application in server.

I am using Html, JavaScript and servlets.

If I run shell script from servlet, it will execute shell script in a server.

I want to execute shell script from client system.

I think if we used JavaScript we can do this. Is there any way to do this?

Other then shell script how can we trigger scanner in browser ?

回答1:

JS cannot interact with client OS or File system (except in limited case as File upload) for obvious security issues.

The only way to do this with webbrowser is to install an ActiveX or DLL on client side that will be able to start your client script. But this is browser specific (and probably Windows specific...).

Maybe you can make the user download the script and then give explanations to execute it himself.



回答2:

You can use Java Web Start or a signed applet. However, this requires the user to install Java.