Forum Moderators: open

Message Too Old, No Replies

Downloading PDF Instead of Opening

Don't want it to open

         

bumpaw

5:20 am on Feb 26, 2005 (gmt 0)

10+ Year Member



I would like to put up some PDFs and give the user the option to save the files and open them later. When I link to them they open automatically. I know they can right click the link and do a "save as" but would like to eliminate that step with html if possible.

sonjay

2:37 pm on Feb 26, 2005 (gmt 0)

10+ Year Member



That's a function that's determined solely by the user's browser/pdf settings.

If you zip the pdf and link to the zipped file, that will guarantee a download, but of course then the user has the extra step to unzip the file.

Lord Majestic

2:54 pm on Feb 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



would like to eliminate that step with html if possible.

Browser determines whats being downloaded (and what default action to take) based on Content-Type: if you create some fancy type that is not recognised by browser like mydata/binary then most (?) browsers (should) prompt to save the file as they don't have default action for that content type.

Doing so might be tricky since most webservers would supply correct content type based on file magic header and/or extention -- you might have to create custom PHP with new header and then read file and send it to client.

Anyhow, you might be able to achieve what you want but if I were you I'd seriously ask your users if they are happy with that -- many expect to have PDF file open in Acrobat Reader when then single click on it.

Jon_King

3:06 pm on Feb 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use a declaration above or below the link:

[Click to Open] or [Right Click to Save]

bumpaw

3:12 pm on Feb 26, 2005 (gmt 0)

10+ Year Member



The example I'm looking at is using a little Javascript to give a Browser popup asking Save or Open the download. Here is what they are using.
[3]
<a id="_ctl0__ctl7__ctl0_grdDocuments__ctl2_lnkDownload" class="CommandButton" href="javascript:__doPostBack('_ctl0$_ctl7$_ctl0$grdDocuments$_ctl2$lnkDownload','')">Download</a>
[/3]