Offer a user option to Open or Save?

Soldato
Joined
9 Nov 2003
Posts
9,515
Location
The Motor City
Is is possible, with a web-page, to give the user the option to Open or Save a file automatically?

For example, my site contains a large amount of PDF documents. I currently have them set to open in a blank window. What I would like, though, is if a person clicks on the document name they get a standard pop-up asking if they would like to Open the file or Save it. This isn't standard behaviour for a PDF file, it seems, only executables and such.
 
No way from the website mark-up that you can specify it, you can get extensions that will emulate the desired behaviour but that is client side.
 
Doesn't the client side determine what to do based on the returned content type. If he overrode the content type to executable in the header and then streamed the PDF in, surely that would trick the client into giving the open or save box.

Don't ask me how to do this though, because I don't have a clue! I think PHP has a header function, apart from that I dunno how you put the PDF onto the stream :P. I think the theory is sound though ;)
 
Also (apparently IE might ignore the content-disposition header)

By removing the file extention '.pdf' you cause your browser to ask
you
what you want to do with the unknown file.

When saving it, it does appearently read the file and recognize it as
a
PDF. This will cause the Save As dialog box to save it with PDF file
extention and so you just need to hit the OK button !

(Obviously this doesn't sound very user friendly if it goes wrong)
 
Back
Top Bottom