哪些版本的IE支持PNG favicon? [英] Which versions of IE support PNG favicons?
问题描述
。
本文包括以下内容:
IE11显示了Favicon支持:
- Favicon可以使用脚本动态更改。
- Favicon网址可以直接指向
- Favicon网址可以直接指向PNG文件。
请注意,由于与旧版IE的兼容性问题,使用直接
.png
favicons可能不是最好的做法,如上所述Eric在同一篇博文中:
当然,只是因为你可以指向
.png
或
.gif
并不意味着
你应该兼容和经验的原因(记住
.ico
可以容纳多个图片大小以最适合显示上下文)
您应该继续使用.ico
作为您的图标。
由Mr.Law撰写的另一篇文章,名为包含以下代码段:
.ico
- 用于
实例,.bmp
,.gif
或
.png
- 无法显示在Internet
Explorer 中。
来自非官方来源的几个引号:
需要一个实际的图标文件,不只是
jpg
或png
将
重命名为ico
extension。 - Greg Hostetler,在IE7中设置Favicon。 。
它必须是Windows图标格式,而不是PNG或GiF,IE8只是
支持ICO。 - xyberbit, MSDN。 。
另一方面,Internet Explorer不支持PNG图标,
,但会忽略PNG favicon并使用ICO favicon,无论
它们被声明的顺序。 - Jonathon T.Neal 。 p>
One。Big。问题。IE10不支持条件注释,它
不支持PNG favicons。 - Jonathon T.Neal
其他查询回答:
- 将文件类型从
.png
命名为.ico
,反之亦然,转换为
解决此不兼容问题?
很遗憾(由@ 测试) Truerror ,在IE10的17/06/2013)。 IE10及之前需要实际图标(
.ico
)。
是一个16x16的
.ico
?
这里是 Microsoft 不得不说:
考虑同时创建一个16x16像素的图标以及一个32x32像素的
图标(带宽更大,带宽允许) ,因为在高DPI显示器上,
Internet Explorer可能会拉伸图标以适应可用空间。
In this old StackOverflow post, it was said that only IE6 had issues with PNG favicons, but on channel9, it said that IE7 also does not support PNG favicons either.
But, unfortunately, the channel9 link has been deleted - so does anyone know the official/tested information that states which version of IE started to support PNG favicons?
解决方案The short answer:
IE11 is the first version of Internet Explorer to support the direct usage of
.png
and.gif
file format favicons.Why the confusion?
As you mentioned, some seem to have implied that .png favicons are supported in IE7+, while others have stated the opposite.
I believe the confusion is caused by the fact that
.png
images can be used inside.ico
files (.ico
files are just image container files after all) as of IE7, which is true .However, previously, direct
.png
favicons were only ever compatible with the other major browsers (Chrome, Firefox etc).Proof of direct
.png
Favicon compatibility in IE11 and beyond:The File Format support section on the Favicon wikipedia page resembles the following:
[20] points to an article called Fun with Favicons written by Eric Law, an ex-Microsoft employee and 2013 Microsoft MVP.
The article includes the following:
IE11 shows some significant improvements in Favicon support:
- Favicons may be changed dynamically using script.
- The Favicon URL may point directly at a GIF file.
- The Favicon URL may point directly at a PNG file.
Note though, that it may not be the best idea to use direct
.png
favicons due to compatibility issues with older versions of IE, as mentioned by Eric in the same blog post:"Of course, just because you can point at a
.png
or.gif
doesn't mean you should-- for both compatibility and experience reasons (remember.ico
can hold multiple image sizes to best suit the display context) you should continue to use a.ico
as your favicon."Another article written by Mr.Law, called IE11 Changes, also briefly mentions IE11's support for direct
.png
and.gif
file format favicons.Proof of
.png
Favicon incompatibility in IE10 and before:There are many official and non official sources proving that IE10 and before only support
.ico
Favicons.As of 13/10/2013, the 'file format support' section of the Favicon Wikipedia page resembles the following:
A 2012 article on MSDN called How to Add a Shortcut Icon to a Web Page contains the following snippet:
"Note that shortcut icons in image formats other than
.ico
— for instance,.bmp
,.gif
, or.png
— cannot be displayed in Internet Explorer."A few quotes from non-official sources:
"First, IE requires an actual icon file. Not just a
jpg
orpng
renamed with anico
extension." - Greg Hostetler, Setting up Favicons in IE7.."It must be windows icon format instead of PNG or GiF, IE8 just supports ICO." - xyberbit, MSDN..
"On the other hand, Internet Explorer does not support PNG favicons, but it will ignore the PNG favicon and use the ICO favicon, regardless of the order in which they are declared." - Jonathon T.Neal.
"One. Big. Problem. IE10 does not support conditional comments, and it does not support PNG favicons." - Jonathon T.Neal
Other queries answered:
Can I just re-name the filetype from
.png
to.ico
and vice-versa to get around this incompatibility issue?Sadly not (tested by @Truerror on the 17/06/2013 in IE10). IE10 and before requires an actual icon (
.ico
) file.Should it be an 16x16
.ico
?Here's what Microsoft have to say about that:
"Consider creating both a 16x16-pixel icon as well as a 32x32-pixel icon (and larger, bandwidth permitting), since on high-DPI displays, Internet Explorer may stretch the icon to fit the available space."
这篇关于哪些版本的IE支持PNG favicon?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!