Favicon 未显示在 IE9 的地址栏中 - 但在所有其他浏览器中显示

发布于 2024-12-27 12:47:22 字数 443 浏览 1 评论 0 原文

这真的很奇怪——我已经尝试了我能想到的一切。我在 Firefox、Chrome 或 Opera 中没有遇到任何问题。当我更改服务器上的图标时,它会立即在其他浏览器上更新,但在 IE9 中仍然不显示。

顺便说一句,当我将图像添加到 IE9 中的收藏夹时,该图像会显示在我的“收藏夹”列表中 - 它只是不会显示在 URL 地址栏中。我还验证了 ico 文件适用于另一个网站。每次进行更改时,我都会忠实地清除 IE 浏览器历史记录/临时互联网文件。以下是我在 .ASPX 文件中尝试过的几个代码版本。第一个版本正在我运行的另一个 ASPX 网站上运行:

<link rel="shortcut icon" href="/favicon.ico" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>

This one is really odd - and I've tried everything I can think of. I have no issues with this in Firefox, Chrome or Opera. And when I change the icon on the server, it is updated immediately on the other browsers, but still doesn't show up in IE9.

Incidentally, the image is displayed in my "favorites" list when I add it to favorites in IE9 - it just won't show up in the URL address bar. I've also verified that the ico file works for another website. I've also faithfully cleared the IE browser history/temporary internet files each time I've made a change. Here are a couple of the code versions that I've tried in the .ASPX file. The first version is working on another ASPX web site that I'm running:

<link rel="shortcut icon" href="/favicon.ico" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>

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

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

发布评论

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

评论(6

梦回梦里 2025-01-03 12:47:22

适用于Windows 7和ie 9或更高版本!

我为这个图标问题苦苦挣扎了好几天——它在所有浏览器中都显示,但在 ie9 中却没有!

我怀疑文件格式;具体来说,它的定义标头定义了 favicon.ico 的结构,因为在遵循了几个教程和方法但没有成功后,它是唯一剩下要检查的东西!

看来我是对的 – windows 7 + ie9 期望图标被构造为 4 个图标,全部包含在一个文件中。

一步一步:

1)我构建了一个 64x64 像素 24 位彩色图形并将其保存为 png 文件

2)我将此文件导入到名为 X-icon Editor 的 freebee 中,在此处获取它 http://www.xiconeditor.com/

3)预览结果后(将有四个图像 64x64, 32x32、24x24 和 16x6(全部以像素为单位),并对结果感到满意:

4)我导出了结果并在导出之前记下了提示...

5)然后我使用了另存为 设施并将文件定向到我的站点文件的根目录(index.html 文件所在的位置)我保存的文件是 favicon.ico

6) 如果您想查看这些文件,请转到您的站点目录硬盘上并双击 favicon.ico 文件,Windows 照片查看器将显示 4 个页面,每个页面代表图标大小。

7)按如下方式编辑代码(详细信息请参阅提示步骤 4):在 head 标签下插入此标签:link rel="shortcut icon " href="favicon.ico"/

8) 将更改上传到您的服务器。

9) 清除 ie9 缓存文件

10) 等待大约 20 分钟(可能需要更长的时间)

11) 登录到您的网站,您应该会看到 favicon

那么所有嵌入到单个 favicon.ico 文件中的其他图标是什么?

64x64 是 Windows 使用的大图标(如果您在桌面上创建一个具有大图标的快捷方式,则图标将以 64x64 像素显示您的图形),

32x32 与上面相同,但对于中等桌面图标设置

24x24 与上面相同,但对于小型桌面图标 16x16 的桌面集

是网页上使用的图标。它也是桌面底部栏(任务栏)的 pinto 区域中使用的图标 - 将快捷方式从桌面移动到任务栏,您将看到它调整

大小 全部完成 - 它可以工作 - 耐心等待它出现!

PS(高级用户)您可以拥有多个“Favicon”文件,但您需要重命名所有文件
然后在 head 标签下指向各个页面的每个图标文件 - 但你只允许一个(或多个文件不允许) favicon.ico 文件......如果你是新手,那就有点毛茸茸的,但是去为了它

Aplies to Windows 7 and ie 9 or higher!

I struggled with this favicon problem for days - it showed in all the browsers but not in ie9!

I suspected the file format; speifically its definition-header which defines the structure for the favicon.ico, as it was the only thing left to examine having followed several tutorials and methods to the letter without success!

It seems I was right – windows 7 + ie9 expect the icon to be constructed as 4 icons all contained within one file.

Step by step:

1)I constructed a 64x64 pixel 24 bit color graphic and saved it as a png file

2)I imported this file into a freebee called X-icon Editor get it here http://www.xiconeditor.com/

3)Once I previewed the result (there will be four images 64x64, 32x32, 24x24 and 16x6 (all in pixels) and was happy with the result:

4)I exported the result and noted the tips before doing the export…

5)I then used the save as facility and directed the file to the root of my site files (where the index.html file is located) The file I saved was favicon.ico

6)If you wish to view the files go to the site directory on your hard drive and double click on the favicon.ico file and Windows Photo Viewer will show you 4 pages each representing the icon size.

7)Edit your code under as follows (the detail is found in tips step 4): under the head tag insert this tag: link rel="shortcut icon" href="favicon.ico"/

8)Upload the changes to your server.

9)Clear the ie9 cache files

10)Wait about 20 minute (may take longer)

11)Log onto your site and you should see the favicon

So what are the other icons all embedded into a single favicon.ico file?

64x64 are the large icons used by windows (if you create a shortcut on your desktop which has large icons the favicon will show your graphic in 64x64pixels),

32x32 same as above but for a desktop set for medium desktop icons

24x24 same as above but for a desktop set for small desktop icons

16x16 is the favicon used on your web page. Its also the icon used in the pinto area at the bottom bar of the desktop (taskbar)– move the shortcut from the desktop to the task bar and you’ll see it resize

All done – it works – be patient for it to appear!

PS (advanced users) you can have more than one "Favicon" file but you'll need to rename all of them
then under the head tag point to each of the icon files for the various pages - but you're only allowed one (or none for multiple files) favicon.ico files.... gets a bit hairy if you are a novice but go for it

爱人如己 2025-01-03 12:47:22

尝试放置绝对路径而不是相对路径:

<link rel="SHORTCUT ICON" href="http://www.mydomain.com/myicon.ico"/>

另外,你把图像放在哪里。据我记得,它会根据网络浏览器自动从服务器上的某个位置拉取。

Try putting absolute path and not relative path:

<link rel="SHORTCUT ICON" href="http://www.mydomain.com/myicon.ico"/>

Also, where did you put the image. From what I recall, it will automatically pull from a certain location on your server depending on the web browser.

吝吻 2025-01-03 12:47:22

尝试将 rel="shortcut icon" 更改为“icon”。这对我有用。

<link rel="icon" href="/favicon.ico" />

Try changing the rel="shortcut icon" to just "icon". This works for me.

<link rel="icon" href="/favicon.ico" />
虐人心 2025-01-03 12:47:22

如果您使用的是 HTML4 或 HTML5,请在标记末尾使用 >,对于 XHTML,请使用 />

另外,您可能需要尝试使用 type="image/vnd.microsoft.icon"

来源FavIcon(在地址栏中)无法在 IE 中工作9

Use > at the end of the tag if you're using HTML4 or HTML5, and /> for XHTML.

Also, you might need to try using type="image/vnd.microsoft.icon"

Source: FavIcon (in Address bar) not working in IE 9

看透却不说透 2025-01-03 12:47:22

尝试网站:http://favicon.htmlkit.com/favicon/(已在每个浏览器中测试并工作) )

1) 清除浏览器缓存。 2) 包含您从上述站点创建的包中的所有图像。

Try site: http://favicon.htmlkit.com/favicon/ (tested and working in every browser)

1) Clear browser cache. 2) Include all the images in the package which you create from the above site.

夏雨凉 2025-01-03 12:47:22

我在 IE9 中的字体和图标上遇到了同样的问题。虽然我广泛研究了客户端问题,但服务器设置实际上导致了这种情况。

在IIS中将客户端缓存控制模式设置为“DisableCache”。这导致 IE9 无法加载字体或图标。所有其他(现代)浏览器都运行良好。

在 IIS 7 中,您应该在图标或字体文件夹上将缓存控制设置为“NoControl”:

<location path="fonts">
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="NoControl" />
    </staticContent>
  </system.webServer>
</location>

I had the same problem with fonts and favicon in IE9. While I researched extensively on client side problems, server settings were actually causing this.

The client cache control mode was set to "DisableCache" in IIS. This was causing IE9 not to load either the fonts or the favicon. All other (modern) browsers worked well.

In IIS 7 you should set cache control to "NoControl" on the either the favicon or the font folder:

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