demosthenes.info

I’m Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with , and . To receive more information, including news, updates, and tips, you should follow me on Twitter.

featured articles

popular favourites

Using link rel to preload web content and aid accessibility

Continuing from the theme of the last entry, another good example of accessibility benefitting everyone, not just those with special needs, is using the <link> tag in the <head> section.

Most web pages only use the <link> tag to do one thing: draw CSS information into a document, via a linked style sheet:

  1. <link rel=”stylesheet” type=”text/css” href=”styles.css” media=”all” />

That rel attribute stands for “relationship”, i.e. the relationship between the HTML document and the CSS. This means that the <link> tag can also be used for navigation, while continuing to be written in the <head> section. Let’s say you were on the “Contact” page of a website. In the head section, you would add:

  1. <link rel=”home” title=”Home” href=”index.html” />
  2. <link rel=”next” title=”Next” href=”services.html” />
  3. <link rel=”prev” title=”Previous” href=”products.html” />
  4. <link rel=”help” title=”Get Help” href=”about.html” />

There are arguments in response to this from anyone familiar with HTML code:

“These links will never be seen on the page, because they are written in the <head> section”

True only in a browser under normal conditions. Those using assistive technology, such as the Firefox Site Navigation Bar, will be able to see it.

“My website can’t be navigated in a linear fashion”

True only to a certain extent. While this is a natural navigation method for blogs, websites with less structure can still have an implied linear navigational pattern: just think of which page would be logical to go to next, and which page might be before the one you’re on now. The home and help links will always remain the same, of course.

There is one other benefit to using the <link> tag in this manner: Firefox uses the “next” link to “prefetch” web page content, on the assumption that the page is likely to be the next page you visit.

This means that while you are looking at the current page, Firefox is downloading the next page: if you decide to go there, the transition will be much smoother, with minimal or no loading time. Other browsers are likely to adopt this behaviour.

You could also use this feature in Firefox to download a large image behind the scenes that you know will be used later in your site:

  1. <link rel=”prefetch” href=”images/bigbobobanner.jpg” />

(While it is valid HTML, other browsers will ignore the line above. More information about prefetching from the Mozilla Developer website.)

Hopefully this lesson, along with the previous one, shows that adding accessible features is not a chore, or a benefit to only a small minority of users, but an integral part of a website that yields advantages for everyone.

You must be signed up in order to leave comments.

web developer guide

featured comment

by Aisling Brock in New Business Card Design

what i'm reading

A Feast for Crows: A Song of Ice and Fire: Book Four
A Feast for Crows: A Song of Ice and Fire: Book Four

what i'm watching

Prometheus: Collector's Edition (Bilingual) [Blu-ray 3D + Blu-ray + DVD + Digital Copy]
Prometheus: Collector's Edition (Bilingual) [Blu-ray 3D + Blu-ray + DVD + Digital Copy]

what i'm playing

Borderlands
Borderlands

what i'm hearing

Planets
Planets

blogs

podcasts

no ads ever

This blog is free of advertising, and always will be.

creative commons licensed

The content of this blog is free to use in whatever way you wish under the Creative Commons license.