Favicon request not showing in network tab of developer toolbars

天涯浪子 提交于 2020-01-31 06:23:26

问题


I've set up my ASP.NET MVC app with a favicon in the Content folder (instead of the root) along these lines. This works well, the favicon shows in all browsers.

However when I installed ELMAH I started seeing 404 errors because apparently the favicon is still being requested at the root of my site! I would love to know why this is happening and who is doing this. Under the assumption my browser was causing this I opened up the developer toolbars, here's what I find:

Google Chrome:

Internet Explorer 9:

Firefox:

All of them show 9 similar requests, but none of them show favicon.ico requests ... at all? I would've expected at least one (the one in the Content folder, which I'm seeing in my browser), and rather even two (also the one that's giving me the 404 in ELMAH).

So, my question: Can anyone explain why developer toolbars generally don't show favicon requests? Can this be turned on somehow or seen somewhere?


回答1:


All browsers fetch /favicon.ico by default to use it in the address bar, tabs, bookmarks etc. It's just a convention (and W3C doesn't like it).

Using Chrome you can see this request here: chrome://net-internals/#events.

You can override the icon using <link rel="shortcut icon" href="http://test.com/myicon.ico" /> HTML tag in the <head> section. This seems to prevent Chrome from checking the default location. However, even with this tag set up Chrome DevTools are not displaying favicon.ico as a resource that was downloaded during the page load. The reason for this may be that favicon is not used by the website, it's used by the browser. The browser request it for it's own purposes.

[EDIT] There is an open Chrome issue classifying missing favicon.ico in the Network panel as a bug. [EDIT] Its also a bug in a Firebug.



来源:https://stackoverflow.com/questions/13961283/favicon-request-not-showing-in-network-tab-of-developer-toolbars

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!