Most useful websites use some form of pagination. However, link relations are not in widespread use.
I liked the explanation:
Regular links (<a href>) simply point to another page. Link relations are a way to explain why you’re pointing to another page. They finish the sentence “I’m pointing to this other page because…”
I know a few sites which, to my “View Source” surprise, make use of <a rel="next">.
I wrote a jQuery version under 5 minutes, but not all pages have jQuery. Adding jQuery to the current page is relatively simple (although not trivial: follow the evolution of the jQuerify bookmarklet here, here and finally, here) but the complexity of “importing” jQuery overtakes the even simpler task of finding an <a> tag with a rel attribute.
I also found a Prototype version which … wasn’t working … but …
I don’t need a JavaScript framework: I decided to use the browser DOM 3 XPath which would work on any browser I care about:
Anytime you are looking for a specific node or set of nodes buried inside of a document, consider using XPath to speed up the process in Firefox, Safari, Chrome, and Opera (Internet Explorer doesn’t support DOM 3 XPath).
Here’s the code:
document,
null,
XPathResult.FIRST_ORDERED_NODE_TYPE,
null).singleNodeValue.href
A few notes:
- the rel attribute may be attached to either a <link> or an <a> tag
- I used translate to make the value of rel case-insensitive
- there should only be one rel="next" on the page, the script grabs the first one (a reasonable compromise)
Since I can’t seem to be able to embed a bookmarklet in WordPress, here’s a page where you can grab it.


