Download files instead of viewing in browser

admin

Administrator
Staff member
i have a simple HTML with a hyperlink that links to a .PDF file. As the file is too big, some computers hangs up when opening the file. I want to know if ther is any way to Download <!--more--> directly the file when clicked. When i said directly i mean without using the right button and save link as...<!--content-->Why not link to a the pdf page and then if they want to save it to their desktop after viewing, they can do so.<br />
<br />
Explanation<br />
Just now I searched "Pantone pdf" on yeahoo hoping for a PDF file to show up in the results. One did and the search results can be found at: [ <!-- m --><a class="postlink" href="http://google.yahoo.com/bin/query?p=pantone+pdf&hc=0&hs=0">http://google.yahoo.com/bin/query?p=pan ... &hc=0&hs=0</a><!-- m --> ].<br />
<br />
I then proceeded to click on the first result which took me to the following: [ <!-- m --><a class="postlink" href="http://www.valpo.edu/registrar/ss02housform.pdf">http://www.valpo.edu/registrar/ss02housform.pdf</a><!-- m --> ].<br />
<br />
Thoughts<br />
Once here, the thought came to mind of why not just create a link to that file and set the target="top" to load in the same page over everything or target="_self" if it's in a frame. If you don't mind annoying your viewers with opening other windows, I suppose you could use the target="_new" in the < a href... > tag.<br />
<br />
Hope that helps, or atleast give you some more ideas.<br />
Goodluck, Gandalf. :D<!--content-->if you want them to Download <!--more--> the file, zip it and save as a zip file. This way, not only do you decrease filesize... but you bypass the right click/save as.<!--content-->i was thinking about a javascript or some kind of trick to force the browser to Download <!--more--> the file,<br />
if this isnt posible i think that puting the file as .zip is the best way.<br />
<br />
thanks to all<!--content-->well you do have a choice. you can zip it up and it will work. or you can add a line to .htaccess file and make it an unknown format.<br />
<br />
ex: in the directory where you have your pdf's, create a .htaccess file and add this line in it: <br />
<br />
AddType application/unknown .pdf<!--content-->Scoutt! Can a file like that work on a cheapo server like <!-- w --><a class="postlink" href="http://www.geocities.com">www.geocities.com</a><!-- w --> ?<br />
Can it simply be created in notepad, saved as ".htaccess" without any TXT extension, and contain but the words application/unknown.pdf?<br />
( you put a space before .pdf accidentally? )<br />
<br />
Or is this some fancy feature that people who've paid for their servers can do that I'm completely unaware of?<!--content-->actually I don't think it will work on geocites. they probably have it blocked. try it and see, all it will do is say error or not work. and tht space has to be there as it was intentional. it is not unknown.pdf but unknown .pdf .cgi <br />
<br />
or whatever. you can have more than one in there.<!--content-->Originally posted by scoutt <br />
well you do have a choice. you can zip it up and it will work. or you can add a line to .htaccess file and make it an unknown format.<br />
<br />
ex: in the directory where you have your pdf's, create a .htaccess file and add this line in it: <br />
<br />
AddType application/unknown .pdf <br />
<br />
Thanks scoutt!<br />
but i couldnt make it work, maybe something about permisions or something like that in my server, as i dont manage the whole server i will never know whats up. This works in all kind of servers? or just in NT or Unix?<br />
thanks again<!--content-->well as far as I know all servers recognise the .htaccess file. not quite sure on that though. but not having full rights on your server it might make a difference. oh well I thought I would throw that out there.<!--content-->:cool: Hey Guys you have all forgottenthat the .htacess solution will only give the user the choice to view online or Download <!--more--> I am working on a JavaScript to help you Download <!--more--> the file based on one from one of theose front cover magazine disks however it is worth noting that some browsers do not support the JavaScripts<!--content-->Originally posted by CyberLew15 <br />
:cool: Hey Guys you have all forgottenthat the .htacess solution will only give the user the choice to view online or Download <!--more--> I am working on a JavaScript to help you Download <!--more--> the file based on one from one of theose front cover magazine disks however it is worth noting that some browsers do not support the JavaScripts <br />
the htaccess will / should give you the Download <!--more--> box like a zip file would. your javascript way will do the samething. there is no getting away from that.<!--content-->very simple...right click on the link and click save target as.<br />
<br />
<!-- m --><a class="postlink" href="http://www.boomspeed.com/spaz109ca/savetarget.jpg">http://www.boomspeed.com/spaz109ca/savetarget.jpg</a><!-- m --><!--content-->Originally posted by gb3k <br />
When i said directly i mean without using the right button and save link as... <br />
uhh, spaz he didn't want that way.<!--content-->sorry, didn;'t have time to read it through...but in that case he should make it a .zip fiel...let me guess, he desn't want it that way?<!--content-->:cool: :o =:O whats UP peeps.<br />
<br />
Scout }:-) I have a javascript here that does not ask to Download <!--more--> I am just changing some bits and bobs trust me I have run it and am modifying it for the web.<br />
<br />
Who is General Disk failure and whats he doing on my Hard Drive? Issac Asimov<!--content-->Originally posted by CyberLew15 <br />
:cool: :o =:O whats UP peeps.<br />
<br />
Scout }:-) I have a javascript here that does not ask to Download <!--more--> I am just changing some bits and bobs trust me I have run it and am modifying it for the web.<br />
<br />
<br />
quite curious as to how you did that. the popup Download <!--more--> box that asked if the users wants to Download <!--more--> or install from location is a security isssue in all browsers. if you sercumvent it then I don't want nothing to do with it as it will lead to maliscious acts by the webmaster. tha tis what leads to viruses<!--content-->only a pleb would use such a javascript to transmit viruses also I am going to make it very hard unless you have the program to encrypt/decrypt the filename for reading with the script:o :o :rolleyes: :mad: :O@ :P :P<!--content-->
 
Back
Top