解决 jquery mobile开发HTML5 APP页面一直loading中,加载 ---高版本浏览器兼容性问题

最近在使用jquery mobile开发HTML5 APP时,遇到在安卓系统5.1之上的系统,加载页面时,一直loading加载,无法加载出页面。  客户端日志显示如下提示

 

 随之查 jQuerymobile replaceState.......... 即使有如下地址参考http://www.tuicool.com/articles/JVNJvq2 说明如下

高版本Chrome上一直转圈,页面加载不出来的情况。

Chrome 43以下的版本,Firefox和Safari浏览器都没有这个问题。

查看控制台,报这么一个错误

Uncaught SecurityError: Failed to execute 'replaceState' on 'History': A history state object with Url ....

  

由于习惯用Chrome进行开发调试,Firefox越来越不好用,Safari的Windows版版本也过老,所以决心解决这个兼容性问题。

在国外论坛上找到这么一段代码,加到jquery.mobile.js中后问题解决了。//备注(其中Chrome有个保护机制,要使用jQuery-Mobile就需要加上这句 $.mobile.pushStateEnabled = false;)

$(document).bind('mobileinit',function(){
    $.mobile.changePage.defaults.changeHash = false;
    $.mobile.hashListeningEnabled = false;
    $.mobile.pushStateEnabled = false;
});

  

posted @ 2016-06-23 10:43  Gaochunling  阅读(633)  评论(0编辑  收藏  举报