Can a javascript function start a program downloading and pass a parameter

Discussion in 'Javascript' started by Angus, Apr 18, 2007.

  1. Angus

    Angus Guest

    I have a program which when downloaded from a server downloads another
    program from the same web server and then configures the downloaded
    program. The trouble is I have to hard code in the program the URL to
    download the other program from. So I need to work out how I can do
    the same thing without having a hard coded URL in the file. It is an
    executable generated from a C compiler so I don't want customers to
    have to edit a C source file and compile it.

    I wondered if I could have a web page with a button calling a function
    which could kick off the download and could pass a pass a parameter.
    So it would basically just call a program and pass a parameter.

    eg function would call mystartupprogram('http://www.whateverurl.com/
    downloads/prog.exe', 'http://www.whateverurl.com/downloads/conf.txt')

    Would that be possible? Can a javascript function kick off a file
    download in this way? How do I do it?
    Angus, Apr 18, 2007
    #1
    1. Advertising

  2. Angus

    Darko Guest

    On Apr 18, 4:04 pm, Angus <> wrote:
    > I have a program which when downloaded from a server downloads another
    > program from the same web server and then configures the downloaded
    > program. The trouble is I have to hard code in the program the URL to
    > download the other program from. So I need to work out how I can do
    > the same thing without having a hard coded URL in the file. It is an
    > executable generated from a C compiler so I don't want customers to
    > have to edit a C source file and compile it.
    >
    > I wondered if I could have a web page with a button calling a function
    > which could kick off the download and could pass a pass a parameter.
    > So it would basically just call a program and pass a parameter.
    >
    > eg function would call mystartupprogram('http://www.whateverurl.com/
    > downloads/prog.exe', 'http://www.whateverurl.com/downloads/conf.txt')
    >
    > Would that be possible? Can a javascript function kick off a file
    > download in this way? How do I do it?


    In Javascript, you can download whatever you want, but to my knowledge
    you can't possibly run an executable on the local filesystem nor
    access anything in general from any local filesystem. The whole idea
    was to protect the users from malicious web-programmers. If you,
    however, want to do this anyway, try doing it with Microsoft's ActiveX
    controls from JavaScript (which unfortunately I don't know anything
    about and can't help you), but this removes browser compatibility and
    requires user's confirmation etc.
    Darko, Apr 18, 2007
    #2
    1. Advertising

  3. Angus

    Darko Guest

    On Apr 18, 7:40 pm, Randy Webb <> wrote:
    > Darko said the following on 4/18/2007 11:14 AM:
    >
    >
    >
    > > On Apr 18, 4:04 pm, Angus <> wrote:
    > >> I have a program which when downloaded from a server downloads another
    > >> program from the same web server and then configures the downloaded
    > >> program. The trouble is I have to hard code in the program the URL to
    > >> download the other program from. So I need to work out how I can do
    > >> the same thing without having a hard coded URL in the file. It is an
    > >> executable generated from a C compiler so I don't want customers to
    > >> have to edit a C source file and compile it.

    >
    > >> I wondered if I could have a web page with a button calling a function
    > >> which could kick off the download and could pass a pass a parameter.
    > >> So it would basically just call a program and pass a parameter.

    >
    > >> eg function would call mystartupprogram('http://www.whateverurl.com/
    > >> downloads/prog.exe', 'http://www.whateverurl.com/downloads/conf.txt')

    >
    > >> Would that be possible? Can a javascript function kick off a file
    > >> download in this way? How do I do it?

    >
    > > In Javascript, you can download whatever you want,

    >
    > You can? You could put it in the cache or you could initiate the
    > download dialog box but you sure as Hades won't complete the download
    > with JS and put it anywhere but in the cache.


    Of course. The idea was that the user knows what is happening every
    time he could be interested in it. But Angus's problem wasn't the user
    who wouldn't like the file to be downloaded (otherwise he wouldn't be
    welcome here, being a malicious user) but how to automate the
    program's executing, without user having to do it himself. This,
    however, can't be really done without some advanced non-js techniques.
    Darko, Apr 19, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Glenn M
    Replies:
    3
    Views:
    397
    Andrew Thompson
    Oct 29, 2004
  2. Spartanicus
    Replies:
    4
    Views:
    1,364
  3. Martoon
    Replies:
    9
    Views:
    803
    Kai-Uwe Bux
    Apr 20, 2006
  4. AzamSharp
    Replies:
    2
    Views:
    174
  5. soni2926
    Replies:
    4
    Views:
    108
    William James
    Nov 21, 2008
Loading...

Share This Page