3
I observed that my web-browser kept download PNG and TIFF images, while happily displayed JPG and GIF when I clicked on a link to that image. Ex.
http://somesite.com/image.<format>
On closer inspection of the HTTP response headers, I observed that the difference in the
Content-Disposition
andContent-Type
headers was causing this behavior.
Anyone know why these are treated differently?
PNG:
HTTP/1.1 200 OK
Date: Fri, 16 Jan 2015 01:33:05 GMT
Server: Apache/2.2.21 (CentOS)
Content-Disposition: attachment;filename*=UTF-8''PNG.png
Content-Type: application/octet-stream
JPG:
HTTP/1.1 200 OK
Date: Fri, 16 Jan 2015 01:34:43 GMT
Server: Apache/2.2.21 (CentOS)
Content-Disposition: inline;filename*=UTF-8''JPG.jpg
Content-Type: image/jpeg
GIF:
HTTP/1.1 200 OK
Date: Fri, 16 Jan 2015 01:31:28 GMT
Server: Apache/2.2.21 (CentOS)
Content-Disposition: inline;filename="GIF.gif"
Content-Type: image/gif
Your browser decides whether it will download the file or just display it in place. Which browser are you using? – user3767013 – 2015-01-16T07:57:26.367
@user3767013 - Tested on IE and Chrome. I believe the behavior is almost universal. Note that the images were not embedded into the HTML in
<img>
tags but were links to the file. – Kent Pawar – 2015-01-17T09:53:10.370