Welcome to WebmasterWorld Guest from

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

Incorportating PDF's




5:27 pm on Aug 23, 2005 (gmt 0)

10+ Year Member

I have 3 PDF files I want to put on the site, when they click on the link I want to ask them if they want to open it or download it.

Please could somebody tell me how to do this.


8:15 pm on Aug 23, 2005 (gmt 0)

10+ Year Member

You don't need to do anything besides make a link to the PDF. Files that are handled outside your web browser default to show that prompt you are thinking of... it is a prompt from your browser, not from the code of a webpage. If you're talking about FORCING a user to see that prompt, regardless of whatever download preferences they may have set, that's another thing, but I wouldn't advise messing with people's prefs.


8:22 pm on Aug 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

You can't force the option to appear; as Don Hoagie notes it is a setting on the client side. One workaround is to provide two links, one to a PDF (which will usually open in a browser window) and another to a ZIP file containing the PDF (which will usually prompt to be saved locally).


8:39 pm on Aug 23, 2005 (gmt 0)

10+ Year Member

For many users that isnt the case; if you have a PDF reader installed (say adobe) IE will open the PDF in that program. I have around 40 on one of my sites.


4:08 pm on Aug 24, 2005 (gmt 0)

10+ Year Member

Thank you once agian sound advice. Not quite sure what I would do with out the brains from this site.

Thank you


5:45 pm on Aug 25, 2005 (gmt 0)

10+ Year Member

You can't force the option to appear

Not exactly correct. . . but nearly so. It is a real pain to work around the default browser behavior (which is to open the file for if the user has the application installed on their machine), but there are some scripts that can be used to do so. There is a way with php, for instance. But certainly not with straight HTML or simple javascript.

So, for most the best way to keep the file from opening is to provide an alternate zip version.

Of course, there IS one other way built into all browsers that doesn't require ANY additional files or code -- simply include a line instructing your users to RIGHT-click on the link and choose "Save Target As. . . " All depends on what you think is reasonable to expect of the users of the particular web site.


Featured Threads

Hot Threads This Week

Hot Threads This Month