如何清除 IE 的图标缓存? [英] How to clear IE's favicon cache?

查看:35
本文介绍了如何清除 IE 的图标缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的网站定义了一个最喜欢的图标:

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">

没关系,Internet Explorer (9) 甚至拒绝尝试从服务器获取数据(从 fiddler 进行监控).

It doesn't matter, Internet Explorer (9) refuses to even try to do a fetch from the server (monitoring from fiddler).

我多次尝试清除缓存:

(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.

那么问题就变成了:如何清除 Internet Explorer 收藏夹图标缓存?

So the question becomes: How do i clear the Internet Explorer favorite icon cache?

推荐答案

它在历史记录中存储收藏夹图标的存在或不存在.如果您想重置它,请清除您的历史记录.这里有一个全面的常见问题解答.

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.

引用博客,称其为广泛的答案:

Quoting the blog, calling it an extensive answer:

为什么我的网站没有图标出现在IE7?

why doesn't the favicon for my site appear in IE7?

这是重新发布的最初发表于2007-03-01.原文可以查到此处.此版本已更新为匹配当前的现实.

This is a re-posting of a post originally published on 2007-03-01. The original can be found here. This version has been updated to match what is currently reality.

当我在微软时,我是开发人员负责修复IE7 的 Favicon 故事.原本的IE6 行为是下载网站图标一次——当用户创建网站时收藏夹.我也不想去深入了解这是如何进行的疯狂是有效的,但关键是了解原因的信息看起来很破碎是这样的:映射在网站的 url 和 url 之间因为网站的 Favicon 将被存储在 IE 的历史数据库和实际上图标的位是存储在 Internet 临时文件中文件夹.因此,如果您清除了历史记录或您的缓存,或项目过期了,图标将永远消失.

When I was at Microsoft, I was the developer tasked with fixing the Favicon story for IE7. The original IE6 behavior was to download the favicon once--when a user made a site a Favorite. I do not want to go too deep into the details of how this craziness works, but the key piece of information to understanding why it seemed so broken is this: a mapping between the url of the site the url for the site's Favicon would be stored in IE's History database and the actually bits of the icon would be stored in the temporary Internet files folder. Thus, if you cleared your history or your cache, or the item expired out of either one, the icon would be gone forever.

快进到 IE7.已经结束了自 IE6 发布以来两(三年?)年.我们要实现标签式浏览,我们希望标签显示正确的收藏夹.所以我更新了始终下载 Favicon 代码第一次访问时的图标.代码也记得是否没有 Favicon (404)或者它以某种方式无效(ExtractIcon() 失败).

Fast-forward to IE7. It has been over two (three?) years since IE6 shipped. We want to implement tabbed browsing, and we want the tabs to display the correct Favicons. So I updated the Favicon code to always download the icon on a first visit. The code also remembers if there is no Favicon (404) or it was invalid in some way (ExtractIcon() failed).

这是一个迷你常见问题解答(有一个奖金最后的问题)我写的我在微软的时候:

Here is a Mini-Faq (with one bonus question at the end) that I wrote while I was at Microsoft:

问:如何让网站图标出现在我的网站在 IE7 中?
答:有两种方法.首先是在根目录下放一个文件名为 favicon.ico 的域.这第二种是使用 标签和rel="shortcut icon" 值和 href值设置为您的图标的 URL希望显示.

Q: How do I make a favicon appear for my site in IE7?
A: There are two ways. The first is to put a file in the root of your domain called favicon.ico. The second is to use a <link> tag with the rel="shortcut icon" value and the href value set to the URL for the Icon you wish to display.

问: IE 多久下载一次网站图标?
A: IE 会下载图标当用户第一次访问网站时.这图标存储在临时客户端上的 Internet Files 文件夹机器.有关的其他元数据favicon 存储在用户的 Url 中历史数据库.如果任一商店是已清除或与此有关的项目favicon 已自然过期,然后该图标将再次下载下次访问.如果超过一页(或站点)共享相同的图标,它只下载一次.IE 需要下载图标非常痛苦尽可能少地减少负载在服务器上.

Q: How often does IE download the favicon?
A: IE will download the icon when a user first visits the site. The icon is stored in the Temporary Internet Files folder on the client machine. Additional metadata about the favicon is stored in the user's Url History database. If either store is cleared, or items relating to the favicon have naturally expired, then the icon will be downloaded again on the next visit. If more than one page (or site) shares the same favicon, it is only downloaded once. IE takes great pains to download the icon as few times as possible to reduce load on the server.

问:我看到了一些错误的图标我访问的网站.我该如何解决?
A:如果历史数据库已经变成以某种方式损坏,这可以发生.最简单的解决方案就是使用删除浏览历史记录(在工具菜单)清除缓存和历史商店.

Q: I see the wrong favicon for some sites I visit. How do I fix this?
A: If the history database has become corrupted in some way, this can happen. The simplest solution is just to use Delete Browsing History (on the Tools menu) to clear the cache and the history store.

问:我在我的网站上放了一个 favicon.ico 作为你描述了,但它仍然没有出现.
答:它实际上必须是 .ico(一个图标)文件.位图、png、gif、等,将不起作用.IE7会下载您的临时互联网收藏夹Files 文件夹并调用 ExtractIcon()文件.如果失败,我们将显示默认图标而不是你的图标.

Q: I put a favicon.ico on my site as you described, but it still doesn't appear.
A: It must actually be a .ico (an Icon) file. Bitmaps, pngs, gifs, etc, will not work. IE7 will download your favicon to the Temporary Internet Files folder and call ExtractIcon() on the file. If this fails, we will show the default icon instead of your favicon.

问:我确认我的网站图标真的是一个图标,但它仍然没有出现.
答:由于 IE 加载了您的图标从 Internet 临时文件中删除文件夹,它必须能够实际把它存放在那里.如果您正在设置图标文件的 no-cache 指令,那么IE将无法显示您的图标并将显示默认值图标代替.您可以使用 Fiddler 来验证.

Q: I verified that my favicon really is an icon, but it still doesn't appear.
A: Since IE loads your icon out of the Temporary Internet Files folder, it must be able to actually store it there. If you are setting the no-cache directive for the icon file, then IE will not be able to display your icon and will display the default icon instead. You can use Fiddler to verify.

问:如何创建不同的网站图标对于我网站上的每个页面?
A: 放一个每个页面上的不同标签,指向到不同的图标.

Q: How do I create a different favicon for every page on my site?
A: Put a different tag on each page, pointing to a different icon.

问:我将网站的收藏夹图标更改为不同的图标,但旧的仍然在 IE 中显示.我如何强制 IE更新?
A:如果你只是把favicon.ico 文件在您的根目录中域,IE 没有任何方法知道它是否改变了.强迫一个更新,您需要使用标签和指向与您不同的文件名以前使用过.当前文件名与已知文件名进行比较存储在 Url History 数据库中.当 IE 看​​到文件名已更改时,它将下载您的新图标.或者,您可以询问您的用户清除他们的历史记录和缓存(工具->Internet 选项->删除浏览历史记录),这也将强制 IE 下载新文件.

Q: I changed my site's favicon to a different icon, but the old one still shows in IE. How do I force IE to update?
A: If you just put the favicon.ico file in the root of your domain, IE doesn't have any way of knowing if it changed. To force an update, you need to use a tag and point to a different filename than you previously used. The current filename is compared against the known filename stored in the Url History database. When IE sees the filename has changed, it will download your new icon. Alternatively, you can ask your users to clear their history and cache (Tools->Internet Options->Delete Browsing History), which will also force IE to download the new file.

问:还有什么问题?
答: 两个事情:

Q: What is still broken?
A: Two things:

  1. 如果您指定一个通过标签替代位置,href 成员必须是完全合格的并且不尊重标签.
  2. 标签必须有快捷方式图标"作为 rel 值,但这是在违反 W3C 规范说rel 标签中的空格表示一个值列表.IE 对待捷径"icon" 作为单个值.幸运的是仍然适用于看到的其他浏览器捷径",忽略它,只付钱注意图标"字符串.

这应该涵盖大部分我收到的有关网站图标的问题在 IE7 中.如果您有更多问题,随时问.

That should cover most of the questions I've received about favicons in IE7. If you have more questions, feel free to ask.

这篇关于如何清除 IE 的图标缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆