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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Download a file automatically using JavaScript

Status
Not open for further replies.

cvasquez

MIS
Feb 28, 2001
88
0
0
US
I want to be able to allow my customers to download a text (*.txt) document onto their PC using the same scheme is using.

If the download for some strange reasons fails then I will allow you to click on a link for a manual download.

I understand that I the in you click on the text document Internet Explorer will show it on it's own screen but I don't want this effect. I want to use a script that could be for any file extension not just txt.

I can also let them know to right click and do a save target as but this won't work...and I don't want to depend on customers actions.

Any of your help will be mostly appreciated.


Carlo Vasquez
 
Did you ever find your answer? I'm trying to accomplish the same thing.

Thanks,
Teresa
 
Thank you for your reply! I really don't understand it though (sorry). Does the iframe go in the body? When I set up the link it just loads it in the browser page. Do you mind explaining this a little more? Much appreciation!
--Teresa


Here is what I have so far:

<html>
<head>
</head>
<body>
<iframe height=&quot;0&quot; width=&quot;0&quot; src=&quot;<p><a href=&quot;../assets/assets_images/image_01.jpg&quot;>Download image</a></p>
<p><img src=&quot;../assets/assets_images/image_01.jpg&quot;></p>
</body>
</html>
 

Inividual browsers &quot;help&quot; their client users by formatting some formatted files into browser-window form.

Defeat the browser? Maybe.

The common trick is to provide a zipped form of the data, and hope that your web client users all have a good unzip utility and the smarts to extract it properly.

I think that is all that download.com does. I found a lot of exe and zip files but no txt files to download there.

The zip is not always good. True, it delivers a real downloaded file - but it confuses or annoys some of your users.

I sure wish there was a way to force a real text file to download - i.e. on a windows platform it should open the text file application (e.g. normally notepad or wordpad).



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top