Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Prerender feature gets canceled every time

I'm trying the prerender feature in chrome, but when I check the network, I can see the request is beeing canceled for any link.

chrome developer console

I'm using the following syntax:

<link rel="prerender" href="http://example.org/index.html">

I tried the live demo at http://prerender-test.appspot.com/ and got the same result. Why is that?

Update (from https://developers.google.com/chrome/whitepapers/prerender):

In some cases while prerendering a site Chrome may run into a situation that could potentially lead to user-visible behavior that is incorrect. In those cases, the prerender will be silently aborted. Some of these cases include:

  • Note: This is not an exhaustive list. Last updated 11/10/11.

    1. The URL initiates a download
    2. HTMLAudio or Video in the page
    3. POST, PUT, and DELETE XMLHTTPRequests
    4. HTTP Authentication
    5. HTTPS pages
    6. Pages that trigger the malware warning
    7. Popup/window creation
    8. Detection of high resource utilization
    9. Developer Tools is open
    10. Plugins such as Flash will have their initialization deferred until the user actually visits the prerendered page.

But the question is when can I use this feature?

like image 348
Shlomi Schwartz Avatar asked Apr 02 '12 09:04

Shlomi Schwartz


2 Answers

In this case it sounds like the prerender requests are being canceled because you have Developer Tools open.

If you want to see more information about the reason why the requests are being canceled, copy and paste chrome://net-internals/#prerender into your omnibox and hit enter.

Prerendering should work in almost all cases that aren't listed in the list of cancellation reasons that you pasted from the whitepaper.

like image 55
komoroske Avatar answered Oct 22 '22 08:10

komoroske


Prerender, Prefetching & Developer Tools:

Prerender And Prefetching Links ( That are not the same features at all ) are disabled when developers tools are open (in most of browsers: IE, Chrome, Firefox) because they are both partly based on "Cache" - Actually "prefetch" is totally based on Cache and sub-resources Because that's what it does - it loads the Future content ( Top Layer only ) to the cache so it will be already available when navigating to the next page. "prerender" uses cache but Also Renders the entire Page into a "hidden Tab" in the background.

When Enabling the Dev Tools the current page is not "Caching" because most of the browsers disables cache by default when dev tools are open.

To see the Prerendering in action and to test it The best method is to use the Task Manager - You will be able to see a Prerender Process Kicking in once the current page is loaded.

All you need To know about Prerender / Prefetching Summarized: HERE

like image 38
Shlomi Hassid Avatar answered Oct 22 '22 10:10

Shlomi Hassid