开发者

Are there any use cases for using the HTML5 <link rel> attribute combination of stylesheet and next?

开发者 https://www.devze.com 2023-02-01 11:30 出处:网络
The HTML5 spec states: Each link created for a link element is handled separately. For instance, if there are two link elements with

The HTML5 spec states:

Each link created for a link element is handled separately. For instance, if there are two link elements with rel="stylesheet", they each count 开发者_如何学JAVAas a separate external resource, and each is affected by its own attributes independently. Similarly, if a single link element has a rel attribute with the value next stylesheet, it creates both a hyperlink (for the next keyword) and an external resource link (for the stylesheet keyword), and they are affected by other attributes (such as media or title) differently.

http://dev.w3.org/html5/spec/Overview.html#attr-link-rel

What would be a use case for using rel="next stylesheet" in the same <link> tag?


I believe that example was made up simply to illustrate the point that one can use both an external resource and a hyperlink keyword in the same link tag. From the list of link types, stylesheet seems to be the only external resource type in common use, which is why I guess it was chosen for this example. The next could have very well been prev or any other hyperlink keyword.


As stated in the documentation, "The exact behavior for links to external resources depends on the exact relationship,...". What this means is that you have control over how your resources are being retrieved.

Suppose that you have a website that used different stylesheets per page within a series, you can prepare the browser to load in those styles and indicate to search engines of the context that the page has in relation to all of your pages.

<link rel="prev" href="about.html">
<link rel="next stylesheet" href="portfolio.html">

Within this example the benefit again is that the styles for the 'next' "are silently prefetching specified documents and stores them in its cache" https://developer.mozilla.org/en/Link_prefetching_FAQ

http://www.w3.org/TR/REC-html40/types.html#type-links


None that I can think of. next and prev are meant to indicate a sequence of documents meant to be read in order.

Maybe if a sequence of documents ended with an example stylesheet that was also used to style the page before it, that might make sense. Unlikely in practice though.

0

精彩评论

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

关注公众号