jqueryjquery-mobileback-buttonpage-loading-message

Back button triggers 'a' event on iphone using jquery mobile


I have a jQuery mobile app that has some code to show the loading screen on (nearly) all links

$(document).on('click', 'a:not(#addyes-link,upgradeyes-link,[rel=close],[data-icon=grid,[title=Close])', function (e) {
    captains.log(e);
    alert(e);
    $.mobile.showPageLoadingMsg();
});

I'm doing this because I have turned off loading the pages with ajax, because I would have to rewrite a huge application that has a working desktop front end.

the problem is that clicking the back button causes the loading image to show. If I comment out the code above it the loading message doesn't appear.

I've tried

$(document).ready(function() {  
    $.mobile.hidePageLoadingMsg();
}

but the message still appears.

Interestingly while if I comment out the above code the spinner stops appearing but the alert doesn't trigger. I think this means it's something to do with the who the page is loaded after pressing back as in the page isn't reloading which is my the hiding code above isn't working.


Solution

  • I added a new class for buttons and a links which I used to load the loading image from js. I'd have much preferred to not have to add classes to my code as there are many more places where it is used than where it isn't.

    If I can replicate it I will submit a bug request to Jquery mobile.