开发者

Favicon issue in website

开发者 https://www.devze.com 2023-01-26 21:25 出处:网络
I am using a favicon which is linked in all pages using <link> tag. This favicon is stored in a folder inside the r开发者_如何转开发oot folder, and I have another favicon stored in the root fold

I am using a favicon which is linked in all pages using <link> tag. This favicon is stored in a folder inside the r开发者_如何转开发oot folder, and I have another favicon stored in the root folder also. When the site loads fully the favicon which I am referring to is shown correctly. But when I stop the site before loading completely then it shows the favicon from the root folder.

Is this the default/desired behavior?

Thanks


I'd say yes.

The only way the browser can find your correct favicon is by using the <link> tag. If that tag's not present or parsed correctly the browser will have to fall back on its default behaviour which is to look for a file called favicon.ico in the root folder.


I don't know about desired behaviour, but it is to be expected. The browser will request /favicon.ico by default, and the <link> is considered an override.

You will find for most browsers, they will actually fetch both, but display the <link> by preference.


Most browsers, if they don't find a <link rel="icon"> or <link rel="shortcut icon">, fall back on the old bog-standard of showing /favicon.ico . Some can be configured to avoid this (e.g. Opera has this in GUI config), some will look for /favicon.ico regardless.

This is an artifact of the Browser Dark Ages and no fault of your own.

0

精彩评论

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

关注公众号