[whatwg] Navigation triggered from unload

James Graham jgraham at opera.com
Tue Jun 12 03:30:09 PDT 2012

What is the expected behaviour of navigation triggered from unload 
handlers? In particular, what stops such navigations from re-triggering 
the unload handler, and thus starting yet another navigation?

It looks like the spec tries to make a distinction between navigations 
that are cross-origin and those that are not (step 4 in the "navigating 
across documents" algorithm); I'm not sure why this inconsistency is 
desirable rather than using the cross-origin approach always.

Based on some tests ([1]-[5]), it seems that WebKit seems to cancel the 
navigation in the unload handler always, Opera seems to always carry out 
the navigation in the unload handler, and Gecko seems to follow WebKit 
in the cross-origin case and Opera in the same-origin case. In all cases 
the unload handler is only called once.

[1] http://hoppipolla.co.uk/tests/navigation/003.html
[2] http://hoppipolla.co.uk/tests/navigation/004.html
[3] http://hoppipolla.co.uk/tests/navigation/005.html
[4] http://hoppipolla.co.uk/tests/navigation/006.html
[5] http://hoppipolla.co.uk/tests/navigation/007.html

More information about the whatwg mailing list