Hi! I'm Johannes Dachsel, a web designer and developer based near Heidelberg, Germany. This is my personal website. Get in touch

Johannes Dachsel

What I learnt today: link prefetching

Today, one of the clients I’m working with asked me to change the rel attribute on a couple of <a> elements to rel="noindex nofollow". I was almost completely sure that there is no noindex value for the rel attribute but I looked it up anyway.

While browsing through the specification of link types, I came across prefetch. I heard of this particular link type the first time in Scott Jehl’s talk at Beyond Tellerand conference in May, but I had almost forgotten about it.

Time to do some research: prefetch basically tells a browser “when you’ve got the time, go and preload this resource and store it in the cache”. An example could look like this:

<link rel="prefetch" href="some-script.js">

This speeds up the page load process when that prefetched resource is needed and works only for cacheable resources.

There is also a dns-prefetch, which preemptively resolves the IP address of a given domain to save time when that resource is requested. For example:

<link rel="dns-prefetch" href="http://some-domain.com">

I guess using these techniques requires a lot of insights on how the user navigates a website. But I think I might give them a try at some point. That’s what I learnt today.