I´m developing an app with jQuery Mobile and Phonegap where I need to check a variable before the first page shows up. It´s only 3 lines of code, where I check if a variable is true or false. If it´s true the user gets redirected to another page with mobile.changePage().
So is there a way to check this variable before the user gets to see the first page. (Must be executed between splashscreen disappears and first page shows up. Thx for your help
You need to listen to pagebeforechange
event and not pagebeforeshow
. Because the first one fires before transition triggers and most importantly before updating browser's history.
pagebeforechange : Triggered twice during the page change cyle: First prior to any page loading or transition and next after page loading completes successfully, but before the browser history has been modified by the navigation process.
pagebeforeshow : Triggered on the "toPage" we are transitioning to, before the actual transition animation is kicked off.
Related post: https://stackoverflow.com/a/19522643/1771795
Take a look at JQM's pagebeforeshow
event. Documentation is here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.