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

A

Angus

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?
 
D

Darko

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.
 
D

Darko

Darko said the following on 4/18/2007 11:14 AM:





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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top