473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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?

Apr 18 '07 #1
3 2391
On Apr 18, 4:04 pm, Angus <anguscom...@gmail.comwrote:
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.

Apr 18 '07 #2
Darko said the following on 4/18/2007 11:14 AM:
On Apr 18, 4:04 pm, Angus <anguscom...@gmail.comwrote:
>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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 18 '07 #3
On Apr 18, 7:40 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
Darko said the following on 4/18/2007 11:14 AM:
On Apr 18, 4:04 pm, Angus <anguscom...@gmail.comwrote:
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.

Apr 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: wired | last post by:
Hi, I've just taught myself C++, so I haven't learnt much about style or the like from any single source, and I'm quite styleless as a result. But at the same time, I really want nice code and I...
11
by: JKop | last post by:
Take the following simple function: unsigned long Plus5Percent(unsigned long input) { return ( input + input / 20 ); } Do yous ever consider the possibly more efficent:
2
by: John J | last post by:
Hi there I have the following code on a site that works as it should but I'd like to understand how it works (a luxury I realise :). I use it to change the colour of buttons on a menu when a...
9
by: beguigne | last post by:
Below is a snippet of a crude date picking routine for a form. I am a novice at this so, I am hitting my head at why when I select the day, the onChange event gives me a blank. What am I missing?...
15
by: Daniel Rudy | last post by:
Hello, Consider the following code: /* resolve_hostname this resolves the hostname into an ip address. */ static void resolve_hostname(char result, const char hostname, const char server) {
8
by: ais523 | last post by:
I use this function that I wrote for inputting strings. It's meant to return a pointer to mallocated memory holding one input string, or 0 on error. (Personally, I prefer to use 0 to NULL when...
4
by: Nathan Sokalski | last post by:
I am a beginner with AJAX, and have managed to learn how to use it when passing single parameters, but I want to return more than one value to the client-side JavaScript function that displays it....
2
by: Franck | last post by:
I am looking for a way to pass a function as parameter, NOT A DELEGATE. what i am trying to do is a worker process as for example of what i want to do : public static void...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.