开发者

What rel values have concrete benefits in a <link> tag?

The <link> tag is most commonly used to associate stylesheets with HTML documents, but as many know, it has a myriad of other 开发者_如何学运维uses as well. In general it represents some relationship between two documents. Its beauty and curse is that anyone can make their own rel values (relationship types) if they wish so. W3C has listed some possibilities, other people have invented even more, and if I want to there's nothing stopping me from adding a <link rel="unicorns>" to my webpage. It will even validate.

However adding random <link> tags to a webpage only wastes bandwidth. What I want to know which rel values actually provide some functionality. And not just some hypothetical functionality that some future user agent might implement, but actual concrete benefits that my users can feel today.

A few that I already know are:

  • stylesheet - the most common use, of course. Attaching CSS stylesheets.
  • canonical - instructs Google (and other search engines) where the "normal" or "canonical" URL of the page is (in case you can view the same page by many URLs);
  • icon - specifies the favicon which browsers show in the URL bar and next to bookmarks.
  • home, index, contents, search, glossary, help, first, start, prev, previous, next, last, up, copyright, author - These appear in Opera's navigation bar and (I'm told) in SeaMonkey plugin for Firefox. Additionally, Firefox preloads in background the <link rel="next"> page and Opera navigates there when you press SPACE at the bottom of current page. I believe I might have seen them in Opera Mini as well, but I'm not sure (does anyone know how these affect mobile browsers?)
  • pingback - used to implement Pingback in blogs.

Are there any other possible <link> tags that actually do something? (Please also include what they do in your answer)


"alternate", at least as a modifier to "stylesheet" does something, in that the stylesheet will initially be in the "disabled" state.


<link rel="prefetch"...> will convince some browsers to preload the page linked to. Used correctly, it can greatly reduce perceived load times along the expected path through your site.

Firefox (for one) uses this today, and Google actually utilizes it. (The first search result, particularly if it's to a common site like Wikipedia, will often include a "prefetch" link to the page found.)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜