-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thad,
On 6/29/2010 4:05 PM, Thad Humphries wrote: > "application/octet-stream" is one way, but it's by no means bullet-proof. > If the file name has an extension, some version of IE will blow off the MIME > type and do what they damn well please based on the extension. s/some version/all versions/ MSIE is not a compliant HTTP user agent by the W3C definition, and this is one of the ways in which it breaks. Hassan had the answer: it's the Content-Disposition header. Even MSIE follows the rules on that one, and you can force a download. > A while back I did some digging around and found that for all browsers I > should call response.addHeader("Content-Disposition", "attachment; > filename="myfile.pdf"). Then for IE I call > response.setContentType("application/force-download; name="myfile.pdf") > while for Firefox and Safari I use > response.setContentType("application/octet-stream; name="myfile.pdf") works > best. That made-up Content-Type doesn't do anything at all for you, and it's horribly broken. The Content-Type should not contain the "name" of the file -- it's all in the Content-Disposition header. The OP wants to /not/ download the file: the best advice is, as Zachary suggested earlier, to simply correctly set the Content-Type to application/pdf and take no further action. If there's a plug-in, it'll probably run and display the file. Otherwise, the browser will likely ask you to download the file or run it with a viewer you choose at the time. - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwqqQAACgkQ9CaO5/Lv0PDrxwCgii7AOxCHKfY+lCPZcPTvJTNE zPsAn2rRbNNecEqdABvTsmvfMhBNkksQ =TAfx -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org