Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Execute a command from an HTML page

    I hope I have this in the correct section. I am looking for a way to execute a program and/or command from an HTML page. I cannot seem to figure out why I can't get it to work. I assumed it would be something simple like:

    <a href="/usr/bin/palimpsest">TEST</a>
    But apparently not. I'm sure its something simple that I'm missing, but can someone steer me in the right direction?


  2. #2
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Western Kentucky
    You need to use cgi-bin to execute stuff like that. Otherwise, use PHP.

    Run shell script from web page
    linux user # 503963

  3. #3
    Also, what are you trying to do, exactly? That command appears to attempt to launch the Disk Utility GUI - but it would open on the server, not the client's desktop. Also, it would probably fail to load at all b/c it does not have permission to access the local desktop X server (probably).

  4. $spacer_open
  5. #4
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Seattle, WA, USA
    HTML cannot do this. It is simply not a part of HTML. However, depending on what you are trying to do, it may be possible.

    If you are trying to launch a program on the computer of whoever is viewing your website, it is impossible. All that you deliver to the person looking at your site is HTML, and as I said, HTML cannot do this. Furthermore, Web browsers are specifically designed to prevent pages from executing programs, even by accident or via security vulnerabilities.

    If you want to use a program to help generate the HTML that you send back to the viewer, this can be done. For instance, you could write a page that would list all of the programs installed in /usr/bin on the server and uses ls to accomplish this.

    Doing this requires using a more complicated setup than using static HTML: it requires use of dynamically-generated web pages. Some examples of this are CGI, PHP, and Ruby on Rails. Using these is outside the scope of this thread, but good tutorials can be found online.

  6. #5
    Its sort of complicated what I'm trying to do, honestly. Basically I am trying to instead of use the desktop and applications menu and such, just run everything from a browser window. It doesn't have to run inside the browser window, just be able to be launched from it.

    It doesn't have to be HTML. PHP would be nice to use too. Maybe I'll see about going that route if that would work.

  7. #6
    It would not - see Cabhan's answer. You should look at using VNC - you can run a VNC server on a machine, then access that session via a VNC java applet, within a browser. Kind of what you want...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts