问题
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.
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.
- The URL initiates a download
- HTMLAudio or Video in the page
- POST, PUT, and DELETE XMLHTTPRequests
- HTTP Authentication
- HTTPS pages
- Pages that trigger the malware warning
- Popup/window creation
- Detection of high resource utilization
- Developer Tools is open
- 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?
回答1:
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.
回答2:
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
来源:https://stackoverflow.com/questions/9973992/chrome-prerender-feature-gets-canceled-every-time