0

I'm developing a Web Application and I got stuck at this:

I want to create a simple tag that triggers the execution of a local program such as gedit, mozilla firefox, etc.

My project is based on HTML, Javascript and PHP.

I'm aware that Javascript doesn't allow this kind of execution, but perhaps PHP does?

Thank you!

4
  • Local as in on the client computer? The client doesn't see your php, it's all parsed and run server-side with the output being sent to the client. So you can't do anything on the client with php. I'm not even sure why you would want to do this... Commented Feb 11, 2011 at 14:35
  • I just want to launch a program locally (means that the program is located in the machine where the app is running) ... It's impossible? Not even using Javascript? Commented Feb 11, 2011 at 14:40
  • You basically want to recreate a remote desktop type thing via html/javascript? Sorry, not going to work. The HTTP protocol is NOT designed for something like this. There are remote desktop clients that can work inside a browser, but internally they do NOT use http Commented Feb 11, 2011 at 14:46
  • If you write an application for an Intranet in a company, you can configure the browsers to answer specifically to a file extension (eg. .xyz opens gedit). Then your PHP program generates the required headers to tell the browsers a stream of data is coming, with a given extension, binary format etc... The user (client) will see a popup (Do you want to open gedit for a coming .xyz file?) and should answer yes to start the download. When the download is completed gedit is opened with the temporary file downloaded, given as argument. Commented Feb 11, 2011 at 15:09

2 Answers 2

3

PHP code runs on the server; it has no influence over what happens in the web browser. All it can do is generate HTML and Javascript for the web browser to process, it can't take any action on the client machine directly, so no, there's no way to do this.

Sign up to request clarification or add additional context in comments.

3 Comments

I s'pose someone would want a site that could spawn infinite instances of gedit on the server. What they'd do with it, other than making it a DoS, I don't know.
Is possible to do it using any client-side technology?
This really ends up being a security issue - the browser shouldn't, and generally won't - allow a website to interact with other software that is installed on the computer. There are exceptions however. Some software applications register themselves with the browser to allow themselves to be executed. For example, most instant messaging applications have this capability, MS Office, and Adobe Reader, among others. These applications can be targeted by changing the link. <a href="ymsgr:sendIM?user">IM</a> will cause Yahoo! Messenger to open an IM window to "user", for example.
1

You can do that with exec() function but the program has beign executed on the server doesnt on the client side

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.