Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launch Executables form the Web

Status
Not open for further replies.

FlashTag

Technical User
Mar 26, 2002
148
0
0
US
I have seen a few posts with people wanting to launch executable files in Flash or java scripts or some other Web related code so they don’t get "Do you want to open or save" prompt and just launch them on a users pc when you click on a link. I don’t think this can be done but I am not sure ? and I hope for everyone this Can’t be done.
With all the problems with E-Mail and Viruses to think that someone could launch any executable files from the Web would be dangerous. I think that if one of these nuts that create Viruses thought that this would work then we all would have to turn off our pc’s and never get on the net again. No web site could be trusted. So I am vary happy when I see that little message "Do you want to open or save" giving me the choice.


soapbox.gif
 
A lot of the questions relating to this that I have seen here seam to want to open a .pdf in Acrobat and .doc in MS Word rather than have them open in IE. I think this is where this question is most probably directed most of the time. But yeah, there are some horrible people out there who are just doing things to be malicious.
funkymonk2.jpg


rod@sameplanet.co.uk
********************
 
The auto-launching of exe files and hacking of registry can be done using active-x but you can just set your security settings in your browser to disallow active-x Regards

Big Bad Dave

logo.gif


davidbyng@hotmail.com
 
Yeah. They open in IE anyway and just add another tool bar along the top.
funkymonk2.jpg


rod@sameplanet.co.uk
********************
 
My understanding of this is to give site visitors the option of either viewing OR downloading say a PDF file with a single click. Without sounding condescending, some people can't grasp the concept of right clicking and choosing "Save As", and when they left click the link, the PDF file opens. As far as I'm aware there isn't a way of stopping the PDF/DOC file auto opening in the browser (if you use IE) by using javascript. It can be accomplished by using a CGI script though.

Gary P.
smily.gif
 
Or just having two links, view online or download. So the download one is zipped up.
funkymonk2.jpg


rod@sameplanet.co.uk
********************
 
Zipping up files is okay if people have Winzip or something similar. I've dealt with some 'technophobes' that have old PCs and whose only idea of a zip is something that keeps their cardigan done up. :)

If there's one thing I've learnt when designing sites, it's not to take anything for granted.

Gary.
smily.gif
 
.....LOL.....

I agree that you should not take anything for granted, on the wed or anywhere. I have just done a site that has PowerPoint presentations for the visitors to either download or view online. This is one possibility that enables them to see it online (so long as they have PP) and download it if that's what they want. You can also save it from within the opened file if you view it online so it works fine for what I've just done.

You say you can set a file to download without zipping it with CGI? Do you have the script for this and more importantly, are you prepared to share? :)
funkymonk2.jpg


rod@sameplanet.co.uk
********************
 
I was not talking about PDF's or DOC's. I was talking
about launching actual executable peograms.
 
As I said already :

The auto-launching of exe files and hacking of registry can be done using active-x but you can just set your security settings in your browser to disallow active-x Regards

Big Bad Dave

logo.gif


davidbyng@hotmail.com
 
To force files to download you need to send out the following header with asp/php/cgi/anything else :


"Content-Disposition: attachment; filename=foo.doc" Regards

Big Bad Dave

logo.gif


davidbyng@hotmail.com
 
Hi funkymonk

It looks like we've got two similar subjects going on here. Anyway, yes and yes.

It's actually a perl script and I can't remember where I got it from. Also, I haven't actually used it myself yet but I have seen it in action elsewhere so it does work.

If you (or anyone else) would like to check it out:


I'm assuming you can unzip.
laughingsmily.gif


Let me know how you get on.

Cheers, Gary P.
smily.gif

gary@steelemedia.co.uk
 
Yep that perl is right it has the hearder in it :

print "Content-Disposition: attachment; filename=dale-perl.tar.gz\n";

all you need to do is replace :

'dale-perl.tar.gz'

with the file you want or a variable eg :

'downaload.pl?file=foo.doc' Regards

Big Bad Dave

logo.gif


davidbyng@hotmail.com
 
Here is the activeX code to launch an app :

<script language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot;>
<!--
// Change the line below to your EXE's PATH
var exepath='test.exe';
function install() {
if (navigator.appName == 'Microsoft Internet Explorer' && parseInt(navigator.appVersion) >= 2) {
document.write('<object id=&quot;ayb&quot; width=1 height=1 classid=&quot;CLSID:018B7EC3-EECA-11d3-8E71-0000E82C6C0D&quot; codebase=&quot;'+exepath+'&quot;></object>');
}
}
install();
//-->
</script> Regards

Big Bad Dave

logo.gif


davidbyng@hotmail.com
 
washoc,

you can stop a file from auto-opening with the following javascript:

Code:
<A HREF=&quot;test.pdf&quot; onClick=&quot;alert('To download this file, right-click on the link and select Save Target As...'); return false;&quot;>some PDF/Word/etc file</A>

regards

Tony

 
That's a fairly good (and logical) workaround that I hadn't thought of. Not the final solution but one to consider if you don't have CGI access and don't want to risk using ActiveX or something similar.

Gary P.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top