This example assigns an "onbeforeunload" event to a body element.
Close this window, press F5 or click on the link below to invoke the onbeforeunload event.