Why do we use Content-Disposition with inline mode in DownloadAction?
Hi there, I'm trying to fix some issue and I'd like to understand why we have the following in DownloadAction: String ofilename = XWiki.getURLEncoded(attachment.getFilename ()).replaceAll("\\+", " "); response.addHeader("Content-disposition", "inline; filename= \"" + ofilename + "\""); response.setDateHeader("Last-Modified", attachment.getDate ().getTime()); To my knowledge, "inline" means that we're giving an indication to the browser so that it does NOT to bring up a "Save As..." dialog box. However my understanding is that when the user uses the /download/ action the attachment is bringing up a Save dialog box. So 2 questions: 1) Why do we use inline? 2) Why is it working? :) Thanks -Vincent ___________________________________________________________________________ Yahoo! Mail r�invente le mail ! D�couvrez le nouveau Yahoo! Mail et son interface r�volutionnaire. http://fr.mail.yahoo.com
Hi, If I recall correctly we do this because otherwise you will trigger a download for embedded gifs and jpegs ! Also to make it switch to the right file name but that's not the "inline" part. Ludovic Vincent Massol a écrit :
Hi there,
I'm trying to fix some issue and I'd like to understand why we have the following in DownloadAction:
String ofilename = XWiki.getURLEncoded(attachment.getFilename()).replaceAll("\\+", " "); response.addHeader("Content-disposition", "inline; filename=\"" + ofilename + "\""); response.setDateHeader("Last-Modified", attachment.getDate().getTime());
To my knowledge, "inline" means that we're giving an indication to the browser so that it does NOT to bring up a "Save As..." dialog box.
However my understanding is that when the user uses the /download/ action the attachment is bringing up a Save dialog box.
So 2 questions: 1) Why do we use inline? 2) Why is it working? :)
Thanks -Vincent
___________________________________________________________________________Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com
------------------------------------------------------------------------
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
-- Ludovic Dubost Blog: http://www.ludovic.org/blog/ XWiki: http://www.xwiki.com Skype: ldubost GTalk: ldubost AIM: nvludo Yahoo: ludovic
On Feb 9, 2007, at 10:23 PM, Ludovic Dubost wrote:
Hi,
If I recall correctly we do this because otherwise you will trigger a download for embedded gifs and jpegs ! Also to make it switch to the right file name but that's not the "inline" part.
Ah ok I understand why it's working. So the browser always tries to display the content on the page but for some mime types it doesn't know how to display them and thus prompts a dialog box. Thanks for the gif/jpg/png/etc hint! I'll document it... Thanks -Vincent
Vincent Massol a écrit :
Hi there,
I'm trying to fix some issue and I'd like to understand why we have the following in DownloadAction:
String ofilename = XWiki.getURLEncoded (attachment.getFilename()).replaceAll("\\+", " "); response.addHeader("Content-disposition", "inline; filename=\"" + ofilename + "\""); response.setDateHeader("Last-Modified", attachment.getDate ().getTime());
To my knowledge, "inline" means that we're giving an indication to the browser so that it does NOT to bring up a "Save As..." dialog box.
However my understanding is that when the user uses the /download/ action the attachment is bringing up a Save dialog box.
So 2 questions: 1) Why do we use inline? 2) Why is it working? :)
Thanks -Vincent
_____________________________________________________________________ ______Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com
--------------------------------------------------------------------- ---
-- You receive this message as a subscriber of the xwiki- [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http:// www.objectweb.org/wws
-- Ludovic Dubost Blog: http://www.ludovic.org/blog/ XWiki: http://www.xwiki.com Skype: ldubost GTalk: ldubost AIM: nvludo Yahoo: ludovic
-- You receive this message as a subscriber of the xwiki- [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/ wws
___________________________________________________________________________ Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. http://fr.mail.yahoo.com
participants (2)
-
Ludovic Dubost -
Vincent Massol