[whatwg] events when navigating away before page load?

Mike Wilson mikewse at hotmail.com
Fri Dec 14 09:07:11 PST 2012


What events are supposed to be fired when the browsing context
gets navigated away before the current page has finished loading,
ie before the load event has been fired?

Trying the below script:
(also on http://jsfiddle.net/Skt22/)
...
<head>
  <script>
    document.addEventListener("DOMContentLoaded", 
      function(){console.log("domload");}, false);

    window.addEventListener("load", 
      function(){console.log("load");}, false);

    window.addEventListener("unload", 
      function(){console.log("unload");}, false);

    window.location = "about:blank";
  </script>
</head>
...

gives the following result in a couple of browsers:

          FF17  Chr23 IE9
          ----- ----- -----
domload   y     y     n
load      n     n     n
unload​   y     y     n

Could someone help me out on what behaviour is spec compliant
here? (I've been reading
http://www.whatwg.org/specs/web-apps/current-work/#navigating-across-documents
but this stuff is quite complex)

Thanks
Mike Wilson



More information about the whatwg mailing list