internet-explorer - 如何清除IE的收藏夹缓存?

标签 internet-explorer caching favicon

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

<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 in this answer认为,收藏的图标与常规Web内容的缓存方式不同,并且不要遵循常规的清除规则。

因此,问题就变成了:如何清除Internet Explorer最喜欢的图标缓存?

也可以看看
  • 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
  • 最佳答案

    它在历史记录中存储是否存在收藏夹图标。如果要重置它,请清除“历史记录”。 Here is a comprehensive FAQ

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

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

    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.

    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.

    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:

    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.

    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.

    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.

    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.

    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.

    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.

    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. If you specify an alternate location via tag, the href member must be fully-qualified and does not respect the tag.
    2. The tag must have "shortcut icon" as the rel value, but this is in violation of the W3C spec that says whitespace in the rel tag denotes a list of values. IE treats "shortcut icon" as a single value. Luckily this still works for other browsers who see "shortcut" and ignore it and only pay attention to the "icon" string.

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

    关于internet-explorer - 如何清除IE的收藏夹缓存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3970936/

    相关文章:

    html - 如何为我的网站制作图标?

    internet-explorer - 为子域设置了 cookie,但 IE 开发人员工具在根域中显示 cookie。我错过了什么?

    css - 在 IE 和 Firefox 中换行长文本

    xml - 是否可以使用 XSL/XPATH 区分 IE8 和 IE9?

    ruby-on-rails - Rails caches_action 正在跳过 before_filters

    google-app-engine - App Engine 中的 favicon.ico "not found error"

    html - Internet Explorer z-index 问题

    c - 通过隐藏 get/set 包装器透明地使用寄存器

    asp.net-mvc - 我应该如何缓存在 ASP.NET MVC 中构建的复杂对象?

    html - 链接到很多 favicon 图像大小会使页面变慢吗?