jquery mobile “error loading page” workaround

Sam Deering
Share

If your seeing a quick error message popup on the screen when redirecting the page to another (or you might be forcing a reload).

Image

Instead of using this:

window.location.href = "/";

Use this:

$.mobile.changePage('/', { reloadPage: true, transition: "none"} );

or if that doesn’t work try this:

$.mobile.changePage('./', { reloadPage: true });

That should fix it. If it don’t then try this, overriding the default settings for the ajax loading error (not recommended but will hack fix it).

$.mobile.pageLoadErrorMessage = "";

Docs: http://jquerymobile.com/demos/1.2.0/docs/api/globalconfig.html

$(document).bind("mobileinit", function(){
  $.mobile.foo = bar;
});

If that still don’t fix it, maybe your using the file protocol?

ref: http://doeswhat.com/2011/03/08/jquery-mobile-error-loading-page/