未捕获的安全错误:无法在“历史"上执行“replaceState":无法在原点为“null"的文档中创建 [英] Uncaught SecurityError: Failed to execute 'replaceState' on 'History': cannot be created in a document with origin 'null'

查看:23
本文介绍了未捕获的安全错误:无法在“历史"上执行“replaceState":无法在原点为“null"的文档中创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的没有收到这个 chrome 错误:

<块引用>

未捕获的安全错误:无法在历史"上执行replaceState":无法在原点为null"的文档中创建

在 Edge、Firefox 和 IE 中没有错误.

我使用 jquery 1.11.1 和 jquery mobile 1.4.5.

这是我的索引文件:

<头><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><身体><div data-role="页面"><div data-role="header" data-add-back-btn="true"><p align="center">测试</p>

<ul data-role="listview" data-filter="true" data-filter-placeholder="Kategoriesuchen" data-inset="true" data-count-theme="b"><li><a href="assets/beck/index.html" data-rel"dialog" rel ="external">Bäckereien </a></li>

<script src="js/jquery-1.11.1.min.js"></script><script src="js/jquery.mobile-1.4.5.min.js"></script>

非常感谢任何帮助!

解决方案

添加:

就在 jquery.mobile-1.4.5.min.js 之前

这适用于 Windows 上的 Android WebViewClient 和 Chrome.

I really don't get this chrome error:

Uncaught SecurityError: Failed to execute 'replaceState' on 'History': cannot be created in a document with origin 'null'

In Edge, Firefox and IE no errors.

I use jquery 1.11.1 and jquery mobile 1.4.5.

This is my index file:

<!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>

Any help much appreciated!

解决方案

Add this:

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

Just before jquery.mobile-1.4.5.min.js

That works with Android WebViewClient and Chrome on Windows.

这篇关于未捕获的安全错误:无法在“历史"上执行“replaceState":无法在原点为“null"的文档中创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
前端开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆