jQuery Mobile pagecontainerbeforeload
Event
Example
Display a message before the request loads:
$(document).on("pagecontainerbeforeload", function(){ alert("pagecontainerbeforeload event triggered!"); });
Definition and Usage
The pagecontainerbeforeload
event is triggered before the request loads.
Related Events:
- pagecontainerload - Triggered after the page successfully loads and is inserted into the DOM
- pagecontainerloadfailed - Triggered if the page request fails
Note: This event is for external pages - After the page loads and is 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("pagecontainerbeforeload", function(event, data){...})
Parameter | Description |
---|---|
function(event, data) | Required. Specifies the function to be executed after the event is triggered. The function has two optional parameters: event object - Contains jQuery event properties (such as: event.target, event.type, etc.), see jQuery Event Reference for more information. data object - Contains the following: url (string) - The absolute or relative URL of the page (sent to $.mobile.loadPage()) absUrl (string) - The absolute path of the URL dataUrl (string) - The URL corresponding to the browser deferred (object) - Contains resolve() or reject() 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. |