Gossamer Forum
Home : General : Perl Programming :

Force download

Quote Reply
Force download
Hi

I've got a few PDF files I am linking to. When the user clicks on one of these files, if he or she has Acrobat installed. it will open it within the browser window (similar to word files etc. - embedded). On Mozilla it will open the file in Acrobat (like it should IMO!!! - i hate MS :-(() anyway... Is there a way to force the browser to open the document in it's rightful application or will it always open it embedded on browsers that are set that way?

Thanks

- wil
Quote Reply
Re: [Wil] Force download In reply to
The final decision to open or download will always be with the client browser. The only alternative would be to offer 2 choices - download as zip or open pdf.

~ ERASER


Free JavaScripts @ Insight Eye
Quote Reply
Re: [Eraser] Force download In reply to
Hm. Thanks for your comments. I'm convinced there must be another way, though. Can't web servers Force-Mime-Type or something to make the file downloadable?

- wil
Quote Reply
Re: [Wil] Force download In reply to
You can't force the client do something with a file via the MIME type as you are only telling the client what content a data file has. Just imagine forcing a client browser to open a exe file programmed to format your hard disk.

A good explanation on why you can't do what you want is here:

http://htmlhelp.com/....html#force-download

~ ERASER


Free JavaScripts @ Insight Eye
Quote Reply
Re: [Eraser] Force download In reply to
But I'm trying to do the opposite - force the client *not* to open the file.

Thanks for the link. It seems the following paragraph could help me:

"RFC 2183 describes the Content-disposition header, which can be used to suggest how the browser should handle documents. The value "inline" suggests that the document should be displayed automatically, and the value "attachment" suggests that the user should prompted before the document is displayed (or saved). Note that this mechanism has significant security implications, which are described in the RFC."

And linking from that page is the following paragraph:

"If you're sending data files of some sort which the user ought to be saving instead of viewing in his/her browser, the best MIME type to use is application/octet-stream; this will usually cause a "save" dialog box to appear. It's not "forced" (a user can configure the browser to do something else with this sort of data), but it's the usual action, and this is the closest you can get to "forcing the browser to save the file."

Which provides my answer - thanks for your help!

- wil

Last edited by:

Wil: Jan 11, 2002, 5:51 AM
Quote Reply
Re: [Wil] Force download In reply to
Well, you did say "Is there a way to force the browser to open the document in it's rightful application"

But anyhow, I'm glad you've found the answer you need.

Good luck with your project.

~ ERASER


Free JavaScripts @ Insight Eye
Quote Reply
Re: [Eraser] Force download In reply to
There are server side technologies, like Cold Fusion, that allow you to print documents (like Excel and PDF) inline within web pages.
========================================
Buh Bye!

Cheers,
Me