HTML5 <body> Event Handler Attributes
The list of event handlers applicable to the <body> element has grown considerably in HTML5. Here is the list with the event that fires the script, take
care when using them as they are not supported in all browsers. These events affect the DOM Window Object - the document in the browser window.
- onafterprint
- After the document has finished printing. - onbeforeprint
- Before the document has started printing. - onbeforeunload
- Before the user leaves the document (the page is 'unloaded'). - onblur - The element loses focus - the browser window loses focus.
- onerror
- The document failed to load properly. - onfocus - The element receives focus - the browser window gains focus.
- onhashchange
- The user navigates to a previous page in the browsing session history. - onload - A script is run when the document loads into the browser window.
- onmessage
- Triggered when a message is displayed. - onoffline
- The page goes offline. - ononline
- The page comes online. - onpagehide
- The browser leaves a page stored in the browsing session history. - onpageshow
- The browser enters a page stored in the browser session history. - onpopstate
- Occurs in certain cases when a windows history changes. - onresize
- The window is resized. - onscroll
- A document in the browser window is being scrolled. - onstorage
- When storage is activated. - onunload - Sets a script to run when a user leaves a page.
