An introduction to the difference between shortcut icon and icon code
statement: [code].lt; link; Con
statement two [code].lt; link rel=.quot; icon.quot; href=.quot; animated_favicon.gif.quot; type=.quot; image/gif.quot; /.gt; [/code]
what is the role of statement two? A variety of methods are used. It is hard to make sure that favicon can be displayed on all computers, even with a browser of the same version. Another limitation of
the following code is that it attaches favicon to a specific HTML or XHTML document. To avoid this, the favicon.ico file should be placed in the root directory. Most browsers will automatically detect and use it.
recommendations include the following two lines of HTML Code:
[code].lt; link rel=.quot; shortcut icon.quot; href=.quot; http://example.com/favicon.ico.quot; Rosoft.icon.quot;.Gt; [/code]
, however, only the first line is necessary, because the "shortcut icon" string will be identified by most standard browsers as a list of possible keywords ("shortcut" will be ignored and only "icon"); and Internet Explorer will take it as a separate name. It is called ("shortcut icon"). The result is that all browsers can understand this code. Only when you want to provide another alternate image for the new browser, such as animation GIF, is it necessary to add second rows.
in HTML, the link element must be in the head element (between.Lt, head.gt, and.Lt; /head.gt).
for XHTML, link must use "/.gt" end (or ".Gt;.Lt; /link.gt"), instead of using ".Gt".
href can, but needless, point to the location of /favicon.ico. It can point to any URL.
images can usually be used in any image format supported by browsers. The
.ico file format can usually be read by all browsers that can display favicon.
set the server to send the correct MIME identity: the
ICO file image/vnd.microsoft.icon (or also for compatibility reasons to use image/x-icon. However, it is best to use the MIME type registered by IANA, because most mainstream browsers now support it) the
GIF file image/gif
PNG file image/png
using the appropriate resolution and color depth.
ICO: includes a variety of resolutions (most commonly used are 16 * 16 and 32 * 32, Mac OS X is sometimes 64 * 64 and 128 * 128) and bit depth (bits per pixel) (mostly using 4, 8, 24 BPP, 16, 256, and 16 million).
GIF: uses 16 * 16256 colors.
PNG: uses 16 x 16256 color or 24 bits.
note: when favicon.ico is placed in the document root directory, it will be found by some browsers that do not handle link components, even if there is no link on your site that points to it. The
standard
Favicon functionality was first created by Microsoft, and the Microsoft Corp's Internet Explorer web browser will request favicon for every web site. The Microsoft link tag does not follow the HTML recommendation [1] of the World Wide Web Consortium (W3C, the World Wide Web Alliance), because the
rel attribute must contain a list of link types with spaces as separators, so a link type containing two words cannot be understood by the standard browser. The
".Ico" file type, a grating format for icons on Microsoft Windows, does not have a registered MIME type, and it does not seem to be understood by most browsers at the time. However, in 2003, this format was registered in IANA, and its MIME type was image/vnd.microsoft.icon, thus eliminating the first part of the problem.
the use of the reserved location on the site is inconsistent with the Architecture of the World Wide Web (the structure of the Internet), and is considered to be a link squatting (linked hijacking).
Mozilla browser adds support for favicon through a method that complies with the Web standard. It uses rel=.quot; icon.quot; and allows network designers to add any favicon that supports the image format. For example,.Lt; link rel=.quot; icon.quot; type=.quot; image/png.quot; href=.quot; /path/image.png.quot;.Gt; Later, since this function will be used for all new content, most browsers have added support to this function.