Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"cookie conflict" in Google Chrome Prerender

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.

like image 824
ashish Avatar asked Oct 07 '14 23:10

ashish


1 Answers

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.

like image 186
Tobias Gschwandtner Avatar answered Nov 08 '22 22:11

Tobias Gschwandtner