jQuery Mobile pagecontainerbeforeloadEvent
Examples
Pop up a message before the request loads:
alert("pagecontainerbeforeload event triggered!");
});
Try it Yourself »
Definition and Usage
The pagecontainerbeforeload event is triggered before the request is loaded.
Related events:
- pagecontainerload- Triggers after the page is successfully loaded and inserted into the DOM.
- pagecontainerloadfailed- Triggers when the page request fails.
Note:This event is used for external pages - after a page is loaded and inserted into the DOM, two events will be triggered. The first event is pagecontainerbeforeload, and the second event may be pagecontainerload or pagecontainerloadfailed.
Syntax
$("document").on("pagecontainerbeforeload",function(event,data){...})
| Parameter | Description |
|---|---|
| function(event,data) | Required. Specifies the function to execute after the event is triggered. This function has two optional parameters: event object- Contains jQuery event properties (such as event.target, event.type, etc.). SeejQuery Event Referencefor more information. data object- Contains the following:
|
More Examples
Related Event Demos
Examples of the pagecontainerload and pagecontainerloadfailed events.
event object
Use the event.type property to return the type of event that was triggered.
data object
Use data.url to return the URL address of the external page.
jQuery Mobile Events