我真的没有得到这个 chrome 错误:
Uncaught SecurityError: Failed to execute 'replaceState' on 'History': cannot be created in a document with origin 'null'
在 Edge、Firefox 和 IE 中没有错误。
我使用 jquery 1.11.1 和 jquery mobile 1.4.5。
这是我的索引文件:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/xy.min.css" />
<link rel="stylesheet" href="css/jquery.mobile.icons.min.css" />
<link rel="stylesheet" href="css/jquery.mobile.structure-1.4.5.min.css" />
<title></title>
</head>
<body>
<div data-role="page">
<div data-role="header" data-add-back-btn="true">
<p align="center">Test</p>
</div>
<ul data-role="listview" data-filter="true" data-filter-placeholder="Kategorie suchen" data-inset="true" data-count-theme="b">
<li><a href="assets/beck/index.html" data-rel"dialog" rel ="external">Bäckereien </a></li>
</ul>
</div>
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/jquery.mobile-1.4.5.min.js"></script>
</body>
</html>
非常感谢任何帮助!
最佳答案
添加这个:
<script>
$(document).bind('mobileinit',function(){
$.mobile.changePage.defaults.changeHash = false;
$.mobile.hashListeningEnabled = false;
$.mobile.pushStateEnabled = false;
});
</script>
就在 jquery.mobile-1.4.5.min.js 之前
适用于 Android WebViewClient 和 Windows 上的 Chrome。
关于javascript - 未捕获的安全错误 : Failed to execute 'replaceState' on 'History' : cannot be created in a document with origin 'null' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32453806/