开发者

What if the favicon is not named favicon.ico?

开发者 https://www.devze.com 2023-02-25 03:44 出处:网络
Are there any restrictions on naming the favorites icon (favicon) file as anything other than favicon.ico?

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 displ开发者_运维技巧aying the icon.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消