I’m trying to prevent a page change in jquery mobile depending on what page the user is currently on but I dont know what is in the data.options object. So basically I need to say if the user is going to index.html AND the calling page is example.html then prevent default.
$(document).bind("pagebeforeload", function (event, data) {
var toPage = data.toPage;
if (toPage == 'undefined') {
return;
} else {
//need additional condition to see current page in the data.objections object?
if (toPage == '/android_asset/www/index.html');
event.preventdefault();
}
});
You actually want to use the
pagebeforechangeevent.I’ve created a sample here http://jsfiddle.net/kiliman/zMnUM/