将页面重定向到另一个页面时,如果在屏幕上看到快速错误消息弹出窗口(或者您可能正在强制重新加载)。
而不是使用此:
window.location.href = "/";
用这个:
$.mobile.changePage('/', { reloadPage: true, transition: "none"} );
或者,如果这样不起作用,请尝试以下操作:
$.mobile.changePage('./', { reloadPage: true });
那应该解决它。 如果不这样做,则覆盖ajax加载错误的默认设置(不建议这样做,但会对其进行破解)。
$.mobile.pageLoadErrorMessage = "";
文件: http : //jquerymobile.com/demos/1.2.0/docs/api/globalconfig.html
$(document).bind("mobileinit", function(){
$.mobile.foo = bar;
});
如果仍然不能解决问题,也许您正在使用文件协议?
参考:http://doeswhat.com/2011/03/08/jquery-mobile-error-loading-page/
From: https://www.sitepoint.com/jquery-mobile-error-loading-page-workaround/