Window event reference


The built-in window variable is an instance of the Window object, which represents the current browser window. The Window object has the following events, which can be applied to
the tag by adding the “on” prefix:
afterprint Triggered after the document is printed
beforeprint Triggered before the document is printed
beforeonload Triggered before the document loads
blur Triggered when the window loses focus
error Triggered when an error occurs
focus Triggered when the window receives focus
haschange Triggered when the document has changed
load Triggered when the document loads
message Triggered when the message is triggered
offline Triggered when the document goes offline
online Triggered when the document comes online
pagehide Triggered when the window is hidden
pageshow Triggered when the window becomes visible
popstate Triggered when the window’s history changes
redo Triggered when the document performs a redo
resize Triggered when the window is resized
storage Triggered when a web storage area is updated
undo Triggered when the document performs an undo
unload Triggered when the user leaves the document

The following is an example of subscribing to a Window event:

window.addEventListener('load', winEvent, false);
function winEvent (e){
alert('Window Load');
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s