About Web Favorites icons shortcut icon and icon Code (reprint)

Source: Internet
Author: User

What is the difference between the shortcut icon and the icon code?
Statement one: <link rel= "shortcut icon" href= "Favicon.ico"/>
Statement two <link rel= "icon" href= "Animated_favicon.gif" type= "Image/gif"/>
Note: statement a Shortcut icon is the icon that appears in front of the URL column
Question: Statement Two what is the role of icon? What's the difference between a statement?
Guidance
In the past, web designers and developers used a variety of methods to ensure that Favicon appeared. It is hard to make sure that Favicon can be displayed on all computers, even in a browser of the same version.
Another limitation of the following code is that it associates favicon with a particular 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.
We recommend that you include the following two lines of HTML code:
CODE:
<link rel= "shortcut icon" href= "Http://www.cable163.com/favicon.ico" type= "Image/vnd.microsoft.icon" >
<link rel= "icon" href= "Http://ewww.cable163.com/favicon.ico" type= "Image/vnd.microsoft.icon" >
However, only the first line is necessary because the "shortcut icon" string will be recognized by most standards-compliant browsers as a list of possible keywords ("shortcut" will be ignored and "icon" only), while the Internet The Explorer will use it as a separate name ("shortcut icon"). The result of this is that all browsers can understand this code. Adding a second row is necessary only if you want to provide another alternate image for the new browser, such as an animated GIF.
In HTML, the link element must be in the head element (between For Xhtml,link, you must use "/>" to End (or "></link>"), and you cannot end with ">".
The href can, but does not, point to the location of the/favicon.ico. It can point to any URL.
Images can often use any image format that is supported by the browser.
The. ico file format can usually be read by all browsers that can display favicon.
Set up the server to send the correct MIME ID:
ICO file Image/vnd.microsoft.icon (or may also use Image/x-icon for compatibility reasons.) However, it is best to use the IANA registered MIME type because most mainstream browsers now support it)
GIF file Image/gif
PNG file Image/png
Use the appropriate resolution and color depth.
ICO: Includes multiple resolutions (most commonly used for 16x16 and 32x32,mac OS x sometimes using 64x64 and 128x128) and bit depth (bits per pixel) (most use 4, 8, and 16 million BPP, i.e. 16, 256, and colors).
GIF: Use 16x16,256 color.
PNG: Use 16x16,256 color or 24-bit.
Note: When Favicon.ico is placed at the root of the document, it will be found by some browsers that do not process the link component, even if there is no link to it on your site.
Standardization
The Favicon feature was first created by Microsoft, while Microsoft's Internet Explorer Web browser would request favicon for every website. The Microsoft-supported link tag does not conform to the HTML recommendations of World Wide Web Consortium (Website consortium) [1] because:
The Rel attribute must contain a list of link types delimited by spaces, so a link type containing two words cannot be understood by a standard browser.
The ". ico" file type (a raster format for Microsoft Windows) does not have a registered MIME type, and it does not seem to be understood by most browsers at that time. However, for 2003 years, this format was registered in the IANA and its MIME type was image/vnd.microsoft.icon, thus eliminating the first part of the problem.
The use of a reserved address on the website (reserved location) contradicts architecture of the world Wide Web (the structure of the Internet) and is considered link squatting (link hijacking) or URI Squatting (URI hijacking).
Mozilla Browser adds support for Favicon through a web-compliant approach. It uses rel= "icon" and allows the network designer to add any supported image formats to the Favicon. For example <link rel= "icon" type= "Image/png" href= "/path/image.png" >. Since this feature will be used for all new content, most browsers have added support for this feature.

About Web Favorites icons shortcut icon and icon Code (reprint)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.