Find the answer to your Linux question:
Results 1 to 6 of 6
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2011
    Posts
    2

    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:

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

    Thanks!

  2. #2
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    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
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    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. #4
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    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.

  5. #5
    Just Joined!
    Join Date
    Nov 2011
    Posts
    2
    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.

  6. #6
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    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
  •