What if we could do the same for the next page that the user will request? This is possible if we have two component:
- We need to guess which page is going to be requested.
- We need to tell the browser to preload it.
Number two is solved by adding a specific link tag that is so far supported by FireFox and Chrome, although implemented in slightly different ways.
The html link
<link rel="prefetch prerender" href="url-to-preload">
prefetch is used by FireFox. My testing indicate that the response to FireFox needs to have correct cache headers otherwise it will be requested again when the user requests this page. You need to look at the web server logs to see the request, FireBug seems to disable the prefetching.
prerender is used by Chrome. My testing indicate that regardless of cache headers the next page load is instant if the user requests this page. The prerendering is displayed as a cancelled get request (screenshot below).
I'm working on a wordpress plugin that will gather usage statistics and generate preloading instructions to the browser.
Inga kommentarer:
Skicka en kommentar