Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Can a javascript function start a program downloading and pass a parameter

Reply
Thread Tools

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

 
 
Angus
Guest
Posts: n/a
 
      04-18-2007
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?

 
Reply With Quote
 
 
 
 
Darko
Guest
Posts: n/a
 
      04-18-2007
On Apr 18, 4:04 pm, Angus <(E-Mail Removed)> 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.

 
Reply With Quote
 
 
 
 
Darko
Guest
Posts: n/a
 
      04-19-2007
On Apr 18, 7:40 pm, Randy Webb <(E-Mail Removed)> wrote:
> Darko said the following on 4/18/2007 11:14 AM:
>
>
>
> > On Apr 18, 4:04 pm, Angus <(E-Mail Removed)> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
pass function into another function as parameter? soni2926 Javascript 4 11-21-2008 05:40 PM
How to pass a parameter for a function parameter in a function AzamSharp Javascript 2 07-05-2008 12:24 AM
STL map compare function - can I pass a parameter? Martoon C++ 9 04-20-2006 12:11 PM
Javascript: is it possible to pass a parameter to a function inside a document write? Spartanicus HTML 4 10-07-2005 08:45 AM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM



Advertisments