如何清除 IE 的图标缓存?
我为我的网站定义了一个最喜欢的图标:
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
任何在我添加图标后访问过该网站的浏览器都可以正常显示该图标。但我自己的浏览器拒绝显示图标。
我已经尝试了我能想到的链接的所有变体:
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="http://example.com/favicon.ico">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/x-icon" href="http://example.com/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="http://example.com/favicon.ico">
<link rel="icon" type="image/x-icon" href="http://example.com/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="renamed.ico">
没关系,Internet Explorer (9) 甚至拒绝尝试从服务器获取数据(从 fiddler 监控)。
我多次尝试清除缓存:
(gear) -> Internet Options -> General -> Delete -> Temporary Internet Files
Alex 在这个答案中< /a> 认为最喜欢的图标的缓存方式与常规网页内容不同,并且不遵循常规清除规则。
那么问题就变成了:如何清除 Internet Explorer 收藏夹图标缓存?
另请参阅
i have a favorite icon defined for my web-site:
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
Any browser that has visted the site after i added the icon can display the favicon fine. But my own browser refuses to show the icon.
i've tried every variation of the link i can think of:
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="http://example.com/favicon.ico">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/x-icon" href="http://example.com/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="http://example.com/favicon.ico">
<link rel="icon" type="image/x-icon" href="http://example.com/favicon.ico">
<link rel="shortcut icon" type="image/x-icon" href="renamed.ico">
It doesn't matter, Internet Explorer (9) refuses to even try to do a fetch from the server (monitoring from fiddler).
i've tried clearing my cache, many times:
(gear) -> Internet Options -> General -> Delete -> Temporary Internet Files
Alex in this answer believes that favorite icons are cached differently than regular web-content, and don't don't follow regular clearing rules.
So the question becomes: How do i clear the Internet Explorer favorite icon cache?
See also
- MSDN: How to Add a Shortcut Icon to a Web Page
- Why isn't my favicon appearing in IE7/8?
- favicon not working in IE
- How do I force a favicon refresh
- Cannot get Favicon.ico to display
- Another favicon not working in IE
- Favicon not showing, my icon is no good
- favicon.ico cannot show on Internet explorer 7
- Why doesn't my favicon display for my web site?
- Favicon not showing, my icon is no good
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
它存储历史记录中是否存在图标。如果您想重置它,请清除您的历史记录。 这里有全面的常见问题解答。
编辑:引用博客,称其为广泛的答案:
It stores the presence or absence of a favicon in History. If you want to reset it, clear your History. Here is a comprehensive FAQ.
Edit: Quoting the blog, calling it an extensive answer:
您可以尝试使用 crowbar 来规避任何缓存策略:添加随机 GET 参数。
它很hacky,但它通常在正确的缓存标头等不起作用的情况下起作用。
You can try circumventing any caching strategies using the crowbar: adding a random GET parameter.
it's hacky, but it often works where proper caching headers etc. do not.
在 IE8 和 IE9 中,您必须使用绝对路径作为 href。无论您使用什么链接rel,相对路径都不起作用。 type= 也不是必需的。
以下内容在所有浏览器(IE、FF、Chrome、Safari、Opera 和 Sea Monkey)中对我来说效果最好:
In both IE8 and IE9 you have to use absolute paths for the href. Relative paths don't work, no matter what link rel you use. type= is also not necessary.
The following has worked the best for me in all browsers (IE, FF, Chrome, Safari, Opera and Sea Monkey):
如果您直接浏览到 favicon 文件(例如 http://www.mydomain.com/favicon.ico) 然后单击 F5(有时是 Ctrl+F5)图标将更新。
这适用于 IE 和 Firefox。
If you browse to the favicon file directly (e.g. http://www.mydomain.com/favicon.ico) and then click F5 (sometimes Ctrl+F5) the icon will be updated.
This works in IE and Firefox.
这解决了我的问题,尽管它是一个黑客。
This fixed my problem, even though its a hack.
您需要将图像转换为 .ico 格式。保存为PNG或JPEG,然后使用此工具http://www.favicon.cc/转换为.ico 格式。仅使用 .ico 扩展名保存图像是不够的,您必须进行转换。
You will need to convert the image to .ico format. Save it to PNG or JPEG and then use this tool http://www.favicon.cc/ to convert to .ico format. Is not enough just save the image with .ico extension, you have to convert.