Gecko:Prerendering
Jump to navigation
Jump to search
Prerendering implementation plan for Gecko
Introduction
Prerendering is a yet-to-be-standardized technology first introduced by Chrome and later adopted by IE which allows the rendering engine to start loading and rendering a web page without any visible UI until the page needs to be displayed to the user. The basic mechanics of the technology are as follows:
- The trigger for prerendering a page. The prerendering operation is controlled by the UA, so the UA will ultimately remain in charge to determine whether to prerender a page and also whether to use the prerendered page when it needs to display the page to the user. For example, the UA may decide to prerender pages that it thinks the user has a high chance of visiting without any indication from the web page, or it may not honor the page's request for a link to be prerendered if it determines that the amount of available memory is not enough for that, etc.
- The Web-facing API. Both Chrome and IE have extended the Page Visibility API for prerendering support, by returning "prerender" from document.visibilityState and true from document.hidden if the page is being prerendered, and also by firing a visibilitychange event when the document is first presented to the user.
- Black-listing problematic functionality. This is by far the biggest chunk of work. There are a number of features which have undesired side-effects such as window.open (you don't want an invisible document being rendered to be able to open a new window) and there are other things such as instantiating plugins on those documents which can have either unknown side effects or can take a lot of effort to make them work properly. Chrome aborts prerendering when it hits these issues. IE seemingly "pauses" the prerendered page and resumes the problematic action (in the case of plugins, delay initializing them). I think it's easiest to abort.