Chrome Prerender feature gets canceled every time

雨燕双飞 提交于 2020-01-01 04:12:07

问题


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.

    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?


回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!