window.onError

JavaScript1.1+, JScript1.0+ Nav3+, IE3+, Opera3+ Syntax

onError="command"

Description

The onError event handler of the Window object is fired when an error occurs loading the page. You may find this useful to try and reload the page, using the reload() method of the Location object.

Example

Listing 7.557 is an example of placing the onError event handler in the <body> tag. If there is an error when loading this page, an alert box will be displayed to the user.

Listing 7.557 Example of Using the onError Event Handler
<body onError='alert("Error: There has been an error loading this page.")'>
							
						

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.