I have been using Chrome's prerendering functionality using
<link rel="prerender" href="/path" />
But after the lates updates, when I try to debug using [chrome://net-internals/#prerender]
. It shows that the prerendering was aborted due to "Cookie Conflict"
.
I tried to debug to make sure if some ajax call is changing the cookies after the page was loaded, but found none. Still the prerender gets aborted. It used to work fine with the previous builds of chrome.
What you are seeing is due to cookie conflicts.
Example:
Suppose a.com uses a cookie greeting=... to indicate a greeting a user wants to be greeted with.
Suppose greeting is set to "hello".
We prerender a.com/a.html, presenting "greeting=hello". When the server generates a.html, it will emit the 'hello' from the cookie on the webpage, which is being prerendered.
Now, before the prerender is shown, suppose some other page on a.com updates greeting to "greeting=howdy"
Next, suppose the user navigates to a.com/a.html. The prerender would be swapped in. However, it saw a different version of the "greeting" cookie than the value it has now. Therefore, the page still shows 'hello', rather than the (updated) 'howdy'.
Internally, it keeps track of all cookies exposed during a prerender (either in HTTP headers or javascript). If any of these are modified before the prerender is shown, it invalidates the prerender.
This kind of invalidation is what you observed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With