jQuery Mobile loading message

MikkoP picture MikkoP · May 1, 2012 · Viewed 46.3k times · Source

When I linked jQuery Mobile to my page, some sort of loading message appeard in the bottom of the page and I can't get a rid of it. I've tried $.mobile.pageLoading(true) but it didn't work.

How should I remove it? I haven't printed it anywhere.

Answer

veeTrain picture veeTrain · May 1, 2012

The 1.4 loader documentation

The 1.4 documentation suggests interaction with the Loader widget. The top of the page describes globally changing the option but it can be nuanced on a link-by-link basis. This may also work:

$( document ).on( "mobileinit", function() {
    $.mobile.loader.prototype.options.disabled = true;
});

Also, according to http://demos.jquerymobile.com/1.4.5/loader/ and http://api.jquerymobile.com/loader/, you can hide the loading experience with the following code:

// As submitted by @Aras
$.mobile.loading( "hide" );
// (or presumably as submitted by @Pnct)
$.mobile.loading().hide();

Option B - disable AJAX loading

Disabling AJAX loading will effectively remove the message.

If you don't want a page to benefit from loading in the background and then showing, you can make it load like 'normal' by specifying the data-ajax='false' on whatever anchor (<a...>) tag you don't want to see a loading message for. There's also a global setting you can use to make all links load 'normally'.

To disable globally (be sure to read this page to understand implications and their recommendations. The new docs may not have warnings):

$.mobile.ajaxEnabled=false;

Option C - just hide it

If you want to use the 1.4 Load Page approach to load external pages, it has an option available for showLoadMsg which you can simply set to false.

The global option (available in earlier versions -- at least 1.0, 1.1, and 1.2 -- read about it here) for just removing the message is:

$.mobile.loadingMessage = false;

The 1.2 and prior documentation says that if you set it to false, no loading message will be shown.