jQuery Mobile pagebeforeloadEvent
Example
Show an alert message before the load request:
alert("pagebeforeload event triggered!");
});
Try it Yourself »
Definition and Usage
The pagebeforeload event is triggered before any loading occurs.
Related events:
- pageload- Triggered when a page is successfully loaded and inserted into the DOM.
- pageloadfailed- Triggered after a page fails to load.
Note:When an external page is loaded into the DOM, two types of events are always triggered: the pagebeforeload event before loading, and after loading either pageload (success) or pageloadfailed (failure).
Syntax
| Parameter | Description |
|---|---|
| function(event,data) | Required. Specifies the function to execute when the pagebeforeload event is triggered. This function contains the following two parameters: Event object- Includes any jQuery event properties (event.target, event.type, etc.). For more information, see thejQuery Event Reference Manual Data object- Contains the following types:
|

More Examples
Related Events Demo
This example demonstrates pageload and pageloadfailed.
Event object
Use the event.type property to return the type of event triggered.
Data object
Use data.url to return the URL of the external page.
Other Extensions
jQuery Mobile Events