What if the favicon is not named favicon.ico?

烂漫一生 提交于 2019-12-01 04:58:08

问题


Are there any restrictions on naming the favorites icon (favicon) file as anything other than favicon.ico?

I know for sure that it can be named anything, as long as the favicon tag refers to the correct file name.

For example:

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

The code above works just fine in displaying the icon.

What I want to know is does this violate any W3C/HTML specifications or this is permitted usage?


回答1:


According to W3C, the preferred method is to actually specify the favicon in the html document rather than relying on favicon.ico in the server root.



来源:https://stackoverflow.com/questions/5691582/what-if-the-favicon-is-not-named-favicon-ico

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