网站图标在 IE 中不工作
我有一个使用自定义 favicon.ico 的网站。 图标在除 IE 之外的所有浏览器中按预期显示。 当尝试在 IE 中显示 favicon 时,我得到大红色 x; 当在另一个浏览器中显示图标时,它显示得很好。 页面源码包括 它确实可以在其他浏览器中工作。 谢谢你的想法。
编辑:已解决:问题的根源是该文件是 jpg 重命名为 ico。 我将该文件创建为 ico,并且它按预期工作。 感谢您的投入。
I have a site using a custom favicon.ico. The favicon displays as expected in all browsers except IE. When trying to display the favicon in IE, I get the big red x; when displaying the favicon in another browser, it displays just fine. The page source includes
and it does work in other browsers. Thanks for your thoughts.
EDIT: SOLVED: The source of the issue was the file was a jpg renamed to ico. I created the file as an ico and it is working as expected. Thanks for your input.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(22)
另外 - 证书错误 (https) 可能会导致网站图标无法显示。 安全团队更改了我们的服务器设置,我开始收到“此网站的安全证书有问题”的信息。 单击“继续访问此网站(不推荐)”。 带我去了网站,但不显示图标。
Also - certificate errors (https) can prevent the favicon from appearing. The security team changed our server settings and I started getting "There is a problem with this website’s security certificate." Clicking on "Continue to this website (not recommended)." took me to the website but would NOT show the favicon.
我发现 Windows 10 和 Windows Server 2016 之间以及 IE 和 Edge 之间存在不同的行为。 我使用 www.microsoft.com 进行了测试。
Windows Server 2016 IE 11:
收藏夹:网站图标
地址栏:站点图标
浏览器选项卡:站点图标
Windows 10 IE 11:
收藏夹:网站图标
地址栏:通用蓝色-E 图标
浏览器选项卡:通用蓝色 E 图标
Windows 10 Edge:
收藏夹:网站图标
地址栏:无图标
浏览器选项卡:站点图标
Windows 10 IE 显示通用图标是怎么回事?
I'm seeing different behaviors between Windows 10 and Windows Server 2016 and between IE and Edge. I tested using www.microsoft.com.
Windows Server 2016 IE 11:
Favorites: site icon
Address bar: site icon
Browser tab: site icon
Windows 10 IE 11:
Favorites: site icon
Address bar: generic blue-E icon
Browser tab: generic blue-E icon
Windows 10 Edge:
Favorites: site icon
Address bar: no icon
Browser tab: site icon
What's the deal with Windows 10 IE showing the generic icon?
这项工作适合我的跨浏览器(IE11、EDGE、CHROME、FIREFOX、OPERA),使用 https://www.icoconverter.com / 创建.ico文件
This work crossbrowser for me (IE11, EDGE, CHROME, FIREFOX, OPERA), use https://www.icoconverter.com/ to create .ico file
尝试如下操作:
添加到 html:
在标记后添加缩小脚本:
其中
测试前清除历史记录:(ctr + shfit + del)
Try something like:
Add to html:
Add minified script after tag:
where
Before test clear history: (ctr + shfit + del)
以管理员身份运行 Internet Explorer。 如果您在正常模式下打开 IE,则 favicon 将不会在 IE 11 (Win 7) 上显示。 我不确定其他版本浏览器上的行为。
Run Internet Explorer as Administrator. If you open IE in normal mode then favicon will not display on IE 11 (Win 7). I am not sure about the behavior on other version of browsers.
解决方案:
我通过简单地将图像的扩展名从 png 更改为 ico,从现有 png 文件创建了一个图标。 我使用 drupal 7 bartik 主题,所以我将快捷方式图标上传到服务器,它适用于 Chrome 和 Firefox,但不适用于 IE。 此外,图像图标在桌面上是白色的。
然后我采纳了这里一些人的建议,并使用图像编辑器将图像的大小减小到 32x32 像素 (gimp 2<<
我以与之前相同的方式上传了图标,并且它在所有浏览器中都运行良好。
在所有浏览器上都运行良好,我爱你们,你们帮我解决了很多问题,谢谢!
THE SOLUTION :
I created an icon from existing png file by simply changing the extension of the image from png to ico. I use drupal 7 bartik theme, so I uploaded the shortcut icon to the server and it WORKED for Chrome and Firefox but not IE. Also, the image icon was white-blank on the desktop.
Then I took the advice of some guys here and reduced the size of the image to 32x32 pixels using an image editor (gimp 2<<
I uploaded the icon in the same way as earlier, and it worked fine for all browsers.
I love you guys on stackoverflow, you helped me solve LOTS of problems. THANK YOU!
感谢您的帮助。我尝试了不同的选项,但以下选项对我有用。
我已在页面标题中添加了上述两行,并且它适用于所有浏览器。
谢谢
Thanks for all your help.I tried different options but the below one worked for me.
I have added the above two lines in the header of my page and it worked in all browsers.
Thanks
可能这对其他人有帮助。
对我来说,即使执行了所有步骤,图标也没有在 IE 中显示。
最后我在MSDN中找到了一条注释 Troubleshooting Shortcut图标。
我在“私人”模式下使用 IE,一旦我在正常模式下验证......收藏夹图标显示正确。
May be this help others.
For me ICON was not getting displayed in IE, even after following all steps.
Finally I found a note in MSDN Troubleshooting Shortcut Icons.
I was using IE in "In Private" mode, once I verified in normal mode.... Fav Icon displayed properly.
关于与 IE9 的不兼容性,我遇到了 这篇 博客文章,其中给出了创建 IE9 识别的网站图标的技巧。
本质上,尝试使用以下站点创建一个图标:http://www.xiconeditor.com/
Regarding incompatibilities with IE9 I came across this blog post which gives tips for creating a favicon that is recognised by IE9.
In an essence, try creating a favicon with the following site: http://www.xiconeditor.com/
检查您的网站图标的响应标头。 它们不得包含“Cache-Control: no-cache”。
您可以使用以下命令从命令行检查这一点:
或者
(或使用其他一些可以显示响应标头的工具)
如果您在其中看到“Cache-Control:no-cache”,请调整您的服务器配置以从favicon 响应或设置 max-age。
Check the response headers for your favicon. They must not include "Cache-Control: no-cache".
You can check this from the command line using:
or
(or use some other tool that will show you response headers)
If you see "Cache-Control: no-cache" in there, adjust your server configuration to either remove that header from the favicon response or set a max-age.
是的,您并没有那么有帮助(提供源代码会非常有用!)但是您开始了...需要检查的一些事情:
代码是否是这样的:
它是否在
?
该图像是真实 ico 文件吗? (重命名位图不是真正的 .ico!格式略有不同)
当您将页面添加为书签时它可以工作吗?
Right you've not been that helpful (providing source would be have been really useful!) but here you go... Some things to check:
Is the code like this:
Is it in the
<head>
?Is the image a real ico file? (renaming a bitmap is not a real .ico! Mildly different format)
Does it work when you add the page as a bookmark?
在 IE 和 FireFox 中,仅在网站访问的第一个页面上请求 favicon.ico,这意味着如果 favicon.ico 需要登录(例如您的网站是封闭网站,需要登录),则图标将不会显示。
解决方案是为 favicon.ico 添加例外,例如在 ASP.Net 中,您在 web.config 中添加:
In IE and FireFox the favicon.ico is only being requested at the first page visited on the site, which means that if the favicon.ico requires log-in (for example your site is a closed site and requires log in) then the icon will not be displayed.
The solution is to add an exception for the favicon.ico, for example in ASP.Net you add in the web.config:
如果有人把它归结为这个答案:
同样的问题:在 IE 中不起作用(包括 IE 10),在其他地方都有效。
事实证明该文件不是“真正的”.ico 文件。 我通过将其上传到 http://www.favicon.cc/ 然后再次下载来修复此问题。
首先,我通过在此站点上生成随机 .ico 文件并使用它代替我的原始文件来测试它。 看到它有效。
Should anyone make it down to this answer:
Same issue: didn't work in IE (including IE 10), worked everywhere else.
Turns out that the file was not a "real" .ico file. I fixed this by uploading it to http://www.favicon.cc/ and then downloading it again.
First I tested it by generating a random .ico file on this site and using that instead of my original file. Saw that it worked.
您是否尝试将图标放在 URI“
/favicon.ico
”处? IE 可能不知道引用它的链接标记方式。更多信息来自 W3。
Did you try putting the icon at the URI "
/favicon.ico
" ? IE might not know about the link tag way of referring to it.More info from W3.
如果您尝试了上述所有操作,但在 IE 中仍然不起作用,请检查您的 IIS 设置(如果您使用的是 Windows Server)。
确保 HTTP 标头 > “启用内容过期”设置,未设置为“立即过期”
If you tried everything above and it still doesn’t work in IE, check your IIS settings if you are using a Windows Server.
Make sure that the HTTP Headers > “Enable content expiration” setting, IS NOT SET to “Expire immediately”
我知道这是一个非常古老的话题,但由于它是我的谷歌搜索中出现的第一个话题,我只想添加我的解决方案:
我也遇到了这个问题,以及客户提供的图标。 它在除 IE 之外的所有浏览器中显示。 添加
link
或meta
标记不起作用,因此我开始查看图标文件的格式。它似乎是一个有效的图标文件(不仅仅是重命名的图像),但最终修复它的是将其转换为图像,将其另存为 GIF,然后将其转换回图标.
测试时还要确保清除 IE 缓存。
I know this is a really old topic now, but as it's the first one that came up on my google search I just wanted to add my solution to it:
I had this problem as well with an icon that was supplied by a client. It displayed in all browsers apart from IE. Adding the
link
ormeta
tags didn't work, so I started to look at the format of the icon file.It appeared to be a valid icon file (not just a renamed image), but what fixed it in the end was to convert it to an image, save it as a GIF, and then converting it back to an icon.
Also make sure to clear the IE cache while you're testing.
我遇到了这个确切的问题,但似乎没有任何效果。 在清除浏览器缓存无数次,甚至将 IE 更新到 v9 后,我发现了这个: http://favicon.htmlkit.com /favicon/
上面的链接完美地解决了我的问题!
I had this exact problem and nothing seemed to work. After clearing the browser cache countless times and even updating IE to v9 I found this: http://favicon.htmlkit.com/favicon/
The above link solved the problem perfectly for me!
上述解决方案都不适合我。
首先,我使用上面建议的网站创建图标来确保图标格式正确。
然后,我将图标从“favicon.ico”重命名为“myicon.ico”,并将以下代码添加到我的页面(在
标记内):
该图标位于与这一页。
这为我解决了问题。 幕后的问题可能与 IE 的缓存有关,但我不确定。
None of the above solutions worked for me.
First of all I made sure the icon is in the right format using the website to create favicons suggested above.
Then I renamed the icon from 'favicon.ico' to 'myicon.ico' and added the following code to my page (within the
<head>
tags):The icon is on the same folder as the page.
This solved the problem for me. The issue behind the scenes had probably something to do with the caching of IE, but I'm not sure.
介意分享网址吗? 许多浏览器可以处理(例如)png 格式的网站图标,而 IE 经常遇到麻烦。 - 此外,旧版本的 IE 不会检查 html 源以获取 favicon 的位置,而只是一心一意地尝试从网络服务器获取“/favicon.ico”。
Care to share the URL? Many browsers cope with favicons in (e.g.) png format while IE had often troubles. - Also older versions of IE did not check the html source for the location of the favicon but just single-mindedly tried to get "/favicon.ico" from the webserver.
我曾经使用 PNG 作为 favicon.ico,它显示在除 IE 之外的所有浏览器中。 也许文件中的某些内容导致 IE 无法识别它。 还要确保它是 32x32。 但不知道这是否重要。 但为了在 IE 中看到它,我必须确保这一点。
希望能帮助到你。 尝试使用其他地方的 ico 文件来看看是否有效。
I once used a PNG as a favicon.ico and it displayed in all browsers except IE. Maybe something in the file causes it to not be recognized by IE. Also make sure it's 32x32. Don't know if it matters though. But it's something I had to make sure in order to see it in IE.
Hope it helps. Try to use an ico file from some place else just to see if that works.
这似乎是一个 ASPX 页面问题,我从未能够在 IE 的任何页面中显示网站图标(所有其他页面是 Chrome、FF 和 safari),我见过的唯一例外的网站是 bing .com、msdn.com 和其他属于 MS 并在 asp.net 上运行的网站,有些东西他们没有告诉我们! 即使是世界知名的网站也无法在 IE 中显示,例如:manu.com(世界上浏览次数最多的运动队)aspx 网站,并且无法在 IE 上显示 favicon。 http://www.manutd.com/favicon.ico 确实显示了图标。
请证明我错了。
this seems to be an ASPX pages problem, I have never been able to show a favicon in any page for IE (all others yes Chrome, FF and safari) the only sites that I've seen that are the exception to that rule are bing.com, msdn.com and others that belong to MS and run on asp.net, there is something that they are not telling us! even world-known sites cant show in IE eg: manu.com (most browsed sports team in the world) aspx site and fails to dislplay the favicon on IE. http://www.manutd.com/favicon.ico does show the icon.
Please prove me wrong.