2 <meta http-equiv=
"expires" content=
"0">
3 <script src=
"prerender_events_common.js"></script>
5 function GetCookie(cookieName
) {
6 var re
= RegExp(cookieName
+ '=([^;]*)');
7 var result
= re
.exec(document
.cookie
);
13 function SetCookie(cookieName
, cookieValue
) {
14 var exp
= "Tue, 31 Dec 2030 23:59:59 GMT";
15 if (cookieValue
== "")
16 exp
= "Thu, 01 Jan 1970 00:00:00 GMT";
17 document
.cookie
= cookieName
+ "=" + cookieValue
+ "; expires=" + exp
;
20 function DidPrerenderPass() {
21 // If the prerender did not set a value, everything's fine.
22 if (ExtractGetParameterBadlyAndInsecurely('set', 0) == 0)
25 // If the prerender set a cookie, querying it again should yield the same
26 // value that was set during the request.
27 var cookieName
= ExtractGetParameterBadlyAndInsecurely('key', "");
28 var cookieValue
= ExtractGetParameterBadlyAndInsecurely('value', "");
29 return GetCookie(cookieName
) == cookieValue
;
32 if (ExtractGetParameterBadlyAndInsecurely('set', 0) != 0) {
33 var cookieName
= ExtractGetParameterBadlyAndInsecurely('key', "");
34 var cookieValue
= ExtractGetParameterBadlyAndInsecurely('value', "");
35 SetCookie(cookieName
, cookieValue
);
38 document
.write(document
.cookie
);