{"id":5119,"date":"2008-11-24T16:35:45","date_gmt":"2008-11-24T21:35:45","guid":{"rendered":"http:\/\/www.drunkenfist.com\/304\/?p=5119"},"modified":"2014-10-08T16:42:59","modified_gmt":"2014-10-08T20:42:59","slug":"code-i-like-link-prefetching","status":"publish","type":"post","link":"https:\/\/htmlcssjavascript.com\/web\/code-i-like-link-prefetching\/","title":{"rendered":"Code I Like &#8211; Link Prefetching"},"content":{"rendered":"<p>I was reading John Resig&#8217;s <a href=\"http:\/\/ejohn.org\/blog\/browser-page-load-performance\/\">Browser Page Load Performance<\/a> post earlier today and followed up from there  on the concept of Link prefetching. Currently supported by Firefox 2+, <a href=\"https:\/\/developer.mozilla.org\/en\/Link_prefetching_FAQ\">Link prefetching<\/a> is a browser based mechanism for fetching &#8220;future&#8221; content. Considering I wrote (and ultimately scrapped*) similar functionality for my gallery pages,  I was obviously intrigued.<br \/>\n<!--more--><br \/>\nIn its basic version it looks like this:<\/p>\n<p><code>&lt;link rel=&quot;prefetch&quot; href=&quot;\/images\/big.jpeg&quot;&gt;<\/code><\/p>\n<p>With the <code>href<\/code> being the target content and the <code>rel<\/code> attribute triggering the prefetching mechanism. Pretty simple. I&#8217;ve already implemented it here on my gallery pages.<\/p>\n<p>One thing I would like to see, <a href=\"https:\/\/developer.mozilla.org\/en\/Link_prefetching_FAQ#Are_anchor_(.3ca.3e)_tags_prefetched.3f\">and this is hinted at on the above linked Mozilla FAQ page<\/a>, is prefetching performed automatically on anchor (&lt;a&gt;) tags with <code>rel<\/code> attribute set appropriately. In my mind that would be any anchor with a <code>rel<\/code> attribute of  <code>next<\/code>, but the <code>prefetch<\/code> value would be fine as well. Personally, if that were supported I wouldn&#8217;t have any (or very little) work to do to take advantage of this feature and in a general sense it would build on what people are already doing using <code>prev<\/code>, <code>next<\/code> and <code>toc<\/code> <code>rel<\/code> attributes on gallery links.<\/p>\n<p>*it was scrapped because I hated the idea of forcing bandwidth usage on people with metered accounts. Since this is a browser based mechanism, it should be relatively painless for people in that situation to control whether or not content is prefetched.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was reading John Resig&#8217;s Browser Page Load Performance post earlier today and followed up from there on the concept of Link prefetching. Currently supported by Firefox 2+, Link prefetching is a browser based mechanism for fetching &#8220;future&#8221; content. Considering I wrote (and ultimately scrapped*) similar functionality for my gallery pages, I was obviously intrigued.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,1],"tags":[],"class_list":["post-5119","post","type-post","status-publish","format-standard","hentry","category-performance","category-web"],"_links":{"self":[{"href":"https:\/\/htmlcssjavascript.com\/wp-json\/wp\/v2\/posts\/5119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/htmlcssjavascript.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/htmlcssjavascript.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/htmlcssjavascript.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/htmlcssjavascript.com\/wp-json\/wp\/v2\/comments?post=5119"}],"version-history":[{"count":0,"href":"https:\/\/htmlcssjavascript.com\/wp-json\/wp\/v2\/posts\/5119\/revisions"}],"wp:attachment":[{"href":"https:\/\/htmlcssjavascript.com\/wp-json\/wp\/v2\/media?parent=5119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/htmlcssjavascript.com\/wp-json\/wp\/v2\/categories?post=5119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/htmlcssjavascript.com\/wp-json\/wp\/v2\/tags?post=5119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}