如何清除 IE 的图标缓存?

发布于 2024-09-28 00:56:09 字数 2610 浏览 3 评论 0原文

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

<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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

陌生 2024-10-05 00:56:09

它存储历史记录中是否存在图标。如果您想重置它,请清除您的历史记录。 这里有全面的常见问题解答


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

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

这是重新发布
最初发表于的帖子
2007年3月1日。原来可以找到
此处。该版本已更新至
符合当前现实。

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

快进到 IE7。已经结束了
IE6 发布已有两(三年?)年了。
我们想要实现标签式浏览,
我们希望选项卡显示
正确的网站图标。所以我更新了
始终下载的 Favicon 代码
首次访问时的图标。代码还
记住是否没有 Favicon (404)
或者它在某种程度上是无效的
(ExtractIcon() 失败)。

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

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

问:IE 多久下载一次
网站图标?
A: IE 将下载图标
当用户第一次访问该网站时。这
图标存储在临时文件中
客户端上的 Internet Files 文件夹
机器。有关的附加元数据
favicon 存储在用户的 Url 中
历史数据库。如果任一商店
已清除或与此相关的项目
favicon自然就过期了,那么
该图标将再次下载
下次访问。如果超过一页
(或网站)共享相同的图标,它
仅下载一次。 IE 采取
费尽心思将图标下载为
尽可能少几次,以减少负载
在服务器上。

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

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

问:我确认我的图标确实存在
是一个图标,但仍然没有
出现。
A:因为 IE 加载了你的图标
从临时 Internet 文件中
文件夹,它必须能够实际
将其存放在那里。如果您正在设置
图标文件的无缓存指令,
那么IE将无法显示
您的图标,并将显示默认值
图标代替。您可以使用 Fiddler
验证。

问:如何创建不同的网站图标
我网站上的每个页面?
答:放一个
每页有不同的标签,指向
到不同的图标。

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

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

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

这应该涵盖大部分
我收到的有关网站图标的问题
在IE7中。如果您还有更多疑问,
欢迎询问。

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:

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.

心安伴我暖 2024-10-05 00:56:09

您可以尝试使用 crowbar 来规避任何缓存策略:添加随机 GET 参数。

 favicon.ico?def=abcdefghijklmn

它很hacky,但它通常在正确的缓存标头等不起作用的情况下起作用。

You can try circumventing any caching strategies using the crowbar: adding a random GET parameter.

 favicon.ico?def=abcdefghijklmn

it's hacky, but it often works where proper caching headers etc. do not.

蓝咒 2024-10-05 00:56:09

在 IE8 和 IE9 中,您必须使用绝对路径作为 href。无论您使用什么链接rel,相对路径都不起作用。 type= 也不是必需的。

以下内容在所有浏览器(IE、FF、Chrome、Safari、Opera 和 Sea Monkey)中对我来说效果最好:

<link rel="shortcut icon" href="http://domain.com/favicon.ico" />

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):

<link rel="shortcut icon" href="http://domain.com/favicon.ico" />
街道布景 2024-10-05 00:56:09

如果您直接浏览到 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.

久随 2024-10-05 00:56:09
<link rel="shortcut icon" href="@Url.Content("~/favicon.ico?xyz=10001")" type="image/x-icon" />

这解决了我的问题,尽管它是一个黑客。

<link rel="shortcut icon" href="@Url.Content("~/favicon.ico?xyz=10001")" type="image/x-icon" />

This fixed my problem, even though its a hack.

烈酒灼喉 2024-10-05 00:56:09

您需要将图像转换为 .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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文