JavaScript
Article

jquery mobile “error loading page” workaround

By Sam Deering

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/

No Reader comments

Recommended
Sponsors
Because We Like You
Free Ebooks!

Grab SitePoint's top 10 web dev and design ebooks, completely free!

Get the latest in JavaScript, once a week, for free.