I am trying to display a favicon.ico
on a web page not as the shortcut icon, but as an image in the page's body. On our test server in IE, the images were failing to display, and we found out it was because the MIME-type configured on the server for the .ico
file type was image/vnd.microsoft.icon
instead of image/x-icon
.
Now, we were able to reconfigure our server and fix the problem, but I was wondering if it is possible to specify which MIME type to use in the <img>
tag and override server-wide settings for a specific file?
There is no attribute for specifying a media type in an img
element. If you use e.g. the object
element instead (it works for images, too, but with some quirks), you can use the type
attribute there. But its definition in HTML 4.01 says: “This attribute is optional but recommended when data is specified since it allows the user agent to avoid loading information for unsupported content types. If the value of this attribute differs from the HTTP Content-Type returned by the server when the object is retrieved, the HTTP Content-Type takes precedence.” In HTML5 CR, it’s a bit different, but the point still is that the type
attribute is not expected to override HTTP headers—quite the contrary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With