开发者

Is this html necessary at all?

<link rel="shortcut icon" href="/favicon.ico"开发者_如何转开发>
<link rel="Bookmark" href="/favicon.ico">

I saw it somewhere,but is <link rel="Bookmark".. necessary?


That bookmark link is incorrect. It should be:

<link rel="bookmark" href="http://my.site.com/some/path/permalink.html">

ie a perma-link and not the icon. See 6.12 Link types from the HTML 4.01 specification:

Bookmark
Refers to a bookmark. A bookmark is a link to a key entry point within an extended document. The title attribute may be used, for example, to label the bookmark. Note that several bookmarks may be defined in each document.


This is the cross-browser way of adding favicons:

<link rel="icon" href="/favicon.ico" />
<link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />  

the icon file itself would preferably be 16x16 pixels and in gif format (IE6 wont use transparent png) and under 500 bytes. Though most modern browsers now accept practically anything, though of course it will be your bandwidth and their waiting.

i googled for a page stating this. link

as cletus mentions, the Bookmark link is not for favicon and the code you provided is actually wrong.

EDIT: the favicon link does not influence your bookmarking itself, yet it helps the browser store a little icon on the tabs or your browser's bookmarks' menu. StackOverflow uses this icon.

But Is It necessary? If your icon is located at /favicon.ico, no it is not absolutely critical at all. Most browsers check that path by default, but if you like me put your favicon in a directory like /images/favicon.ico you would need to tell the browser to get it from there or your server will build up alot of 404-Not Found errors in its log. Which will slow things down (a bit). Also you might want to have different icons for different directories etc.


This is a crossbrowser way to make sure the browser knows where your favicon is located for both viewing the page and bookmarking the page. Chances are, if you don't know what that code is, you don't have a favicon. The easiest way to make on is to make a 16x16px gif and change its extension to '.ico' - then you'll get your little icon in the corner of the browser bar (depending on your browser).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜