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!

start a download

Status
Not open for further replies.

NateBro

Programmer
Sep 1, 2004
233
0
0
US
how would i create a link, that people can click to start the download of a PDF file? and also, how would i detect their internet connection speed?
 

Just a regulat link is all that is required. The user would click on the link and it would start downloading to them. Depending on how they have their browser configured, it may open up in the browser window using the Acrobat plugin (in which case they can manually save the file).

You can detect their internet connection by timing how long it takes for them to recieve a known amount of data. If you have a 200K image, you can tell when it has finished loading (the onload event is triggered on the image). If you use getTime() before you set the src of the image, and then use it again once the onload event has triggered... you can calculate the number of milliseconds that it took to download the 200K image. From there it's a sinple matter to figure out the speed in Mb/sec etc.

Calculating their internet connection speed is not really that reliable... but for the purposes of figuring out an approximate download time for the PDF... it'll do the trick.

Cheers,
Jeff

 
i have the link already set up, but the company wants a "Download" link, i have a frame page, and the lower frame shows the PDF if they have the plug-in, and the top has a go back button, and they want a "Download" link here. i told them people could just save from the PDF and if they do not have PDF, it asks where to save the file. is there any way to call the "Save Target As.." from js?

thanks for your reply about the download time, i didn't think about that.

Nate_Bro

 

Try setting up your web server to deliver files from a certain directory with a generic binary MIME type, and get the PDFs delivered from that folder.

Might work!

Hope this helps,
Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
hmmm...

Their server is really low class and dose not do anything. i doubt they will do that, if i can't do it through their web page control panel, they will not do it.

Thanks for the idea, I'm sure I'll use that if the problem comes up with another web site.


Thanks,
Nate_Bro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top