问题
I would like to know if it is necessary for me to specify it like this:
<link rel="icon" href="[URL]" type="image/x-icon" />
<link rel="shortcut icon" href="[URL]" type="image/x-icon" />
or can I just include it in the root and the browser will look for it?
Also what's the difference between rel="icon"
and rel="shortcut"
?
回答1:
All of the major five browsers look in the site's root for a file named exactly favicon.ico
, regardless of type, automatically.
You can override this with a link
element with rel="icon"
, or rel="shortcut icon"
. The latter is supported by every browser, while the former is more correct, but not recognised by Internet Explorer.
回答2:
Most browsers these days will look for a favicon.ico
file on the root of the site.
来源:https://stackoverflow.com/questions/6798689/do-most-browsers-automatically-search-for-the-favicon-ico