009-3.html (956B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>history.pushState/replaceState and referer headers</title> 5 </head> 6 <body> 7 8 <noscript><p>Enable JavaScript and reload</p></noscript> 9 <div id="log"></div> 10 <script type="text/javascript"> 11 var httpReferer = "{{headers[referer]}}"; 12 var lastUrl = location.href.replace(/\/[^\/]*$/,'\/009-2.html?1234'); 13 parent.test(function () { 14 parent.assert_equals( httpReferer, lastUrl ); 15 }, 'HTTP Referer should use the pushed state'); 16 parent.test(function () { 17 parent.assert_equals( document.referrer, lastUrl ); 18 }, 'document.referrer should use the pushed state'); 19 window.onload = function () { 20 setTimeout(function () { 21 try { history.pushState('','','009-4.html?2345'); } catch(e) {} 22 location.href = '009-5.html?pipe=sub'; 23 },10); 24 }; 25 </script> 26 27 </body> 28 </html>