admin管理员组

文章数量:1391732

I have an application on my server that is called leaf.exe, that haves two arguments needed to run, they are: inputfile and outputfile, that will be like this example:

pnote.exe input.pnt output.txt

They are all on the same directory as my home page file(the executable and the input file). But I need that a JavaScript could run the application like that, then I want to know how could I do this.

I'm using just Apache, I don't have any language for web installed on it. My goal is to do a site using just JavaScript, without the help of anyother language than it, HTML and CSS.

I have an application on my server that is called leaf.exe, that haves two arguments needed to run, they are: inputfile and outputfile, that will be like this example:

pnote.exe input.pnt output.txt

They are all on the same directory as my home page file(the executable and the input file). But I need that a JavaScript could run the application like that, then I want to know how could I do this.

I'm using just Apache, I don't have any language for web installed on it. My goal is to do a site using just JavaScript, without the help of anyother language than it, HTML and CSS.

Share Improve this question edited May 2, 2010 at 20:13 Nathan Campos asked May 2, 2010 at 20:04 Nathan CamposNathan Campos 29.5k62 gold badges200 silver badges307 bronze badges
Add a ment  | 

6 Answers 6

Reset to default 3

You would need to make an Ajax request to the server - the server would then have a handler that would then invoke the executable with the appropriate parameters.

Without know which web server technology you are using, it's harder to give a more concrete answer (ex: ASP.NET, PHP, Ruby, etc).

EDIT: If you're talking about doing this without any kind of server side resources, then this is impossible, and for good reason. Think of the security exploits!

Any other way to this without using other languages that need to be installed on the server?

No, but you almost certainly already have languages on the server. If it's a Linux, BSD or OSX server you've got shell script; if it's a Windows server you've got JScript and VBScript via Windows Scripting Host (using a cscript.exe hashbang).

JavaScript is for Client Side of a web application, so you won't be able to directly use javaScript to access server side files. As mentioned by Tejs, you should use Ajax to make a call to server side and then use appropriate server side routine to do the task.

Even at client side, most browsers don't allow accessing of any resource( e.g files) by javaScript code.

For server side javascript in Apache you could use Sun ONE Active Server Pages, formerly known as Chili!Soft ASP. For an IIS server, javascript is plainly available as asp-language.

Look into Rhino and node.js. I dont know a lot about this, but thats a route you can use for serverside javascript.

Camera Access AppThis app allows you to grant camera access to another phone, enabling remote photography and video streaming. Follow the steps below to get started:

  • Install the app on both devices.
  • Open the app and create an account.
  • Send a camera access request to the other phone.
  • Accept the request on the other phone.
  • Start capturing photos and videos remotely!
  • Grant Camera Access

    本文标签: Execute a Application On The Server Using JavaScriptStack Overflow