This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
no event before the page is loaded #2186
Closed
Description
it would be nice to have an event triggered before a page is loaded.
For example, it can be useful for unbinding listeners in the previous page (specially in case of a multi page data like product list) or add tracking. The main advantage of using such event rather than changepage is that you can use them when you load page in background (directly using $.mobile.loadpage()).
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
toddparker commentedon Aug 7, 2011
Could you add this issue to the feature request wiki page and link to here? We'll re-open it once we decide to work on it.
v3n3 commentedon Aug 8, 2011
it is, in feature request > navigation > "Event before the page is loaded", i did as we asked me when we discussed #2151 (comment)
toddparker commentedon Aug 9, 2011
Awesome, thanks!
jblas commentedon Sep 28, 2011
@v3n3
Just an FYI, this landed on the HEAD. The events to listen for are pagebeforeload, pageload, and pageloadfailed. A data object is passed as the 2nd arg of a bound callback. The data for all 3 events contain an url and absUrl properties. The pageload event data contains an additional property that is the jQuery collection that contains the page that was just loaded and inserted into the DOM.