31

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!

olivier
  • 2,585
  • 6
  • 34
  • 61
  • Without your Javascript code, we won't be able to help you much... – D4V1D Sep 08 '15 at 09:16
  • @D4V1D I didn't change jquery i just load it. – olivier Sep 08 '15 at 09:18
  • Are you running a webserver (locally or not)? – A. Wolff Sep 08 '15 at 09:23
  • @A.Wolff No i don't run one. It worked before without one. Should i use one? – olivier Sep 08 '15 at 09:24
  • 1
    @olivier Ya you should use one, sounds like a change in new update chrome security feature (maybe to fix a security hole, who knows?). Test it running a local server, if it fixes your issue, don't hesitate to post an answer here. If not, don't hesitate to comment – A. Wolff Sep 08 '15 at 09:25

3 Answers3

61

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.

Tony L.
  • 17,638
  • 8
  • 69
  • 66
eFMer
  • 634
  • 5
  • 2
25

The Solution for me was that i have to run a webserver. It's a new chrome security feature and wont be changed according Chromium Bug Post.

Thanks to A. Wolff!

olivier
  • 2,585
  • 6
  • 34
  • 61
0

This can also be caused by Turbolinks (HTML pushState) when working with a local HTML file.

Greg Benedict
  • 219
  • 2
  • 5