Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persistence of jQuery Mobile page loading message

I'm using jQuery Mobile and have turned off the default AJAX handling of forms and links, and I'm using

$.mobile.showPageLoadingMsg()

to display the page loading message when I submit a form that transitions me to a different page. This works fine except for the fact that if I use the hardware back button on the device, or the browser's back button to go back to the form, the page loading message is still running. I've tried calling

$.mobile.hidePageLoadingMsg()

on document ready but this didn't seem to fire when I used the back button to go back.

like image 880
Raul Agrait Avatar asked Jun 14 '11 17:06

Raul Agrait


1 Answers

This could be solved by listening to window unload and hiding the message there:

$(window).unload(function(){
 $.mobile.hidePageLoadingMsg();
});

It seems like somewhat of a hack though.

like image 171
Raul Agrait Avatar answered Sep 28 '22 03:09

Raul Agrait