012.html (980B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>history.replaceState before onload</title> 5 <script type="text/javascript" src="/resources/testharness.js"></script> 6 <script type="text/javascript" src="/resources/testharnessreport.js"></script> 7 </head> 8 <body> 9 10 <noscript><p>Enable JavaScript and reload</p></noscript> 11 <div id="log"></div> 12 <script type="text/javascript"> 13 var newUrl = location.href.replace(/\/[^\/]*$/,'\/011-1.html'); 14 setup({explicit_done:true}); 15 test(function () { 16 history.replaceState('','','011-1.html'); 17 }, 'replaceState should be able to set the location state'); 18 test(function () { 19 assert_equals( location.href, newUrl ); 20 }, 'replaced location should be reflected immediately'); 21 window.onload = function () { 22 setTimeout(function () { 23 test(function () { 24 assert_equals( location.href, newUrl ); 25 }, 'replaced location should be retained after the page has loaded'); 26 done(); 27 },10); 28 }; 29 </script> 30 31 </body> 32 </html>