jQuery Mobile pageloadfailed
Event
Example
Display a message when a page fails to load:
Definition and Usage
The pageloadfailed
event is triggered when a page fails to load.
Related Events:
- pagebeforeload - Event triggered before any load.
- pageload - Triggered after a page is successfully loaded and inserted into the DOM.
Note: When an external page is loaded into the DOM, two types of events are guaranteed to be triggered. The pagebeforeload
event before the load, and either the pageload
(successful load) or pageloadfailed
(failed load) event afterward.
Syntax
Parameter | Description |
---|---|
function(event, data) | Required. Specifies the function to run when the pageloadfailed event is triggered. The function contains the following two parameters: Event object - Includes any jQuery event properties (event.target, event.type, etc.). For more information, see the jQuery Event Reference. Data object - Contains the following types: url (string) - The absolute or relative address passed to $.mobile.loadPage() via the callback. absUrl (string) - Contains the absolute reference of the URL. dataUrl (string) - Contains the browser's URL location. deferred (object) - Contains resolve() or reject(). options (object) - Contains options sent to $.mobile.loadPage(). xhr (object) - Contains the XMLHttpRequest object (sent as the third argument to the $.ajax() success callback). errorThrown - (null, string, object) - When an HTTP error occurs, errorThrown receives the HTTP status message, such as "Not Found" or "Internal Server Error" (sent as the third argument to the $.ajax() error callback). |