onBeforeUnload (Event handler)

An event called before an unload happens.

Availability:

JScript - 3.0
Internet Explorer - 4.0
Property/method value type:Boolean primitive
JavaScript syntax:IEmyObject.onbeforeunload = aHandler
HTML syntax:<HTMLTag onBeforeUnload="...">
Argument list:aHandlerA reference to a function object to handle the event
Supported by objects:BODY, FRAMESET, Layer, LINK, SCRIPT, STYLE, Window

This event is triggered immediately before an unload event. It provides a hook for cleaning up immediately before a page is unloaded.

It is bad User Interface design to call an alert box at this point in the proceedings.

See also:Event, Event handler, Event model, Event names, Event object, Event.returnValue, Handler, onUnload, Semantic event