Prerendering in Chrome

Tuesday, June 14, 2011

Google.com's new Instant Pages feature, announced earlier today, makes some sites appear to load almost instantly when you click on them from the search results page. The feature is enabled by prerendering, a technology that we built into the upcoming version of Chrome, currently in the Dev channel. You can see Instant Pages in action in this video:



What is prerendering? Sometimes a site may be able to predict with reasonable accuracy which link the user is most likely to click on next--for example, the 'next page' link in a multi-page news article. In those cases, it would be faster and better for the user if the browser could get a head start loading the next page so that when the user clicks the page is already well on its way to being loaded. That's the fundamental idea behind prerendering. The browser fetches all of the sub-resources and does all of the work necessary to display the page. In many cases, the site simply seems to load instantly when the user clicks.

Although Google.com is the most high profile site to use prerendering, it's a technology that is available to any site. Triggering prerendering well, however, is challenging to do correctly and will only be useful to a handful of sites that have a high degree of certainty of where their users will click next. Triggering prerendering for the wrong site could lead to the link the user did click on loading more slowly.

The vast majority of sites will automatically work correctly when a third party like Google.com asks Chrome to prerender them. If you're interested in testing how your page behaves when being prerendered you can use this sample page. If you want your page to behave differently, you can use Chrome's new experimental page visibility API to detect prerendering.

The page visibility API - which is in the early stages of standardization in the webperf working group - can help developers understand the visibility status of their page: whether it's in a foreground tab, a background tab, or being prerendered. This is still an experimental implementation and it may change or even be removed in the future, which is why for the time being we've prefixed the property names with "webkit.” Although the page visibility API is useful for detecting prerendering, it also has many other applications--for example, allowing a site to pause expensive physics calculations when the page isn't visible.

To learn more about the page visibility API and prerendering, check out the Using the Page Visibility API and Web Developers' Guide to Prerendering in Chrome articles.

11 comments:

Magma said...

A great chrome feature would be 'automatic zoom to fit' zooming setting.

Once selected, the page would zoom to fit the width of the browser, just like it happens on mobile devices.

I think it would be better if it didn't zoom higher than 100% displays, but zoomed for smaller screens automatically.

Magma said...

Oh, and this feature is great...

Keep up the good work

Joze Proton said...

Magma.. There is an already an extension for automatically zooming web pages to width in Chrome. Zoomy. https://chrome.google.com/webstore/detail/jgfonhdeiaaflpgphemdgfkjimojblie?hl=en-GB#

trixiebelden said...

Will this pre-rendering trigger a pageview/visit in Google Analytics? if so, what if the user ends up NOT clicking over to my #1 ranked page...could this begin to inflate my GA metrics?

bt said...

This comment has been removed by the author.

polpqaa said...

Or to summarize, even the full pilot shows little signs of meaningful serialization, aside from the hope that Emerson would choose a quality project.-superior Breguet watch

New Best Friend said...

hey guys,

your prerendering test isn't working for me. when's that going to be live?
thanks,
Cheryl

Nate the Great said...

This sounds like it could spell trouble for sites that allow user-initiated actions to take place using query values from the URL.

For example: suppose there is a site with a URL: http://example.com/db?action=delete_everything and Chrome decides to 'prerender' that page. What happens? If the URL is to be believed, everything gets deleted.

Mike said...

What if the first search result is like some illegal porn site that made it through the cracks? With this tech, now their IP will show in the logs even if they never visited. I think that's a big time security problem.

Fizwidget said...

I agree with Mike, I can see potential security problems with this. As Mike mentions, illegal/dodgy sites may be loaded without the user ever having clicked on them.

Also, does pre-rendering involve executing JavaScript/Flash/etc on the pre-rendered sites? If so, couldn't a user's system could be compromised by a bad site without them ever clicking on the link?

I really hope Google address these issues...

Caleb Taylor said...

Great feature along with the new print preview...!

What you need however as step to making Chrome appear an operating system in its own right is to make the Omnibar optionally INVISIBLE. We ONLY need to see the Omnibar when we are typing in an address right? (Unless we want to be security conscious all the time), so all we need to see is the TABS, and extensions... and we can use the "+" (new tab) or an "omnibar icon" (you can make this), to click on to get the omnibar to (temporarily) appear until we hit enter... (2)... Could we have a split-screen mode please, where we can split up the tabs to the left or right without having to have a repeat of all the surplus icons (extension icons, resizing icons etc) - no extension has such control over tabs to be able to make this happen seamlessly! Then we will have an invincible Chrome that no one will be able to resist!!!