jQuery Mobile pagecontainerloadfailed
Event
Example
Display a text message after the page has successfully loaded and been inserted into the DOM:
$(document).on("pagecontainerloadfailed", function(){ alert("Sorry, the requested page does not exist."); });
Definition and Usage
The pagecontainerload
event is triggered after the page has successfully loaded and been inserted into the DOM.
Related Events:
- pagecontainerbeforeload - Triggered before the request is loaded
- pagecontainerload - Triggered after the page has successfully loaded and been inserted into the DOM
Note: This event is used for external pages - after the page is loaded and inserted into the DOM, two events are triggered. The first event is pagecontainerbeforeload
, and the second event could be either pagecontainerload
or pagecontainerloadfailed
.
Syntax
$("document").on("pagecontainerloadfailed", function(event, data){...})
Parameter | Description |
---|---|
function(event, data) | Required. Specifies the function to run when the event is triggered. The function has two optional parameters: the event object - contains jQuery event properties (such as event.target, event.type, etc.), see jQuery Event Reference for more information. The data object - contains the following: url (string) - the absolute or relative URL address of the page (sent to $.mobile.loadPage())<br> absUrl (string) - the absolute path of the URL<br> dataUrl (string) - the URL address corresponding to the browser<br> deferred (object) - contains resolve() or reject()<br> options (object) - options sent to $.mobile.loadPage(). Note: You can manually handle the request by calling event.preventDefault() in the event object, and the deferred object in the data object contains resolve() or reject() methods. |