如果我有网站图标,我需要链接到它吗?
我有一个网站图标,在我的页面中我有类似的内容:
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
这工作正常。但受到《Ultra Fast asp》一书的启发,我试图删除所有不必要的小部分。无论如何,我读了很多关于浏览器寻找 favicon.ico 的内容。 (人们抱怨如果没有图标就会出现 404 错误)。
所以我想知道:如果浏览器无论如何都要查找该链接,那么该链接有什么用呢?是"枯木"->那么我可以完全删除这个链接还是我错过了一些东西。
谢谢你的想法, 普伦
I have a Favicon and in my page I have something like:
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
This works fine. But inspired by the book "Ultra Fast asp" I am trying to remove all the small bits that are not necessary. I read a lot about browsers looking for favicon.ico anyway. (People complaining about 404 errors if they do not have a favicon).
So I was wondering: what is the use of the link if the browser looks for it anyway. It is "dead wood" -> so can I just remove this link completely or am I missing something.
thanks for your ideas,
Pleun
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
W3C 指定的标准使用链接标记,而不是自动在根目录中查找文件,但所有主流浏览器都支持这两种方式。
关于 favicon 的维基百科文章很好地概述了可能性和浏览器支持。
The standard specified by W3C uses the link tag rather than automagically look for the file in the root, but all major browsers will support both ways.
The Wikipedia article about favicon is a good overview of the possibilities and the browser support.
使用显式链接语法允许您在不同页面上使用不同图标,并且在不会自动下载位于网站的根目录。
如果您只在网站上使用过一个图标,并且不关心不会自动下载根图标的浏览器,则不需要这些链接。
Using the explicit link syntax allows you to use different icons on different pages, and to have icon support on the browsers that do not automatically download the
favicon.ico
that is in the root of the site.If you only ever use one icon on a website and don't care about browsers that do not automatically download the root icon, the links are not needed.
只要您的网站图标位于网站的根目录中(即
/favicon.ico
),那么您就可以删除此链接。该链接允许您更改要存储网站图标的位置。As long as your favicon is in the root of your website (ie.
/favicon.ico
), then yes you can drop this link. The link allows you to change where you want to store your favicon.