Uncaught SecurityError: Failed to execute 'replaceState' on 'History'

Uncaught SecurityError: Failed to execute 'replaceState' on 'History': A history state object with URL 'file:///C:/Users/Administrator/Desktop/%E5%BE%AE%E4%BF%A1/%E4%BA%91%E5%88%9B/index.html' cannot be created in a document with origin 'null'.

在引入jQuery mobeil 的js和css后,兴奋的在谷歌上进行测试时,却发现报了上诉错误。纳闷了,我都是按着步骤来的啊,并且没有错啊,怎么会这样啊!这是由于谷歌的新的安全机制

Chrome recently change their security in relation to local HTML files ability to access History.

下面是解决办法:

1. Switch to a different brand of web-browser.  (火狐等其他浏览器是可以的)
You can change back to Chrome once the developer of Snowman is able to release a new version with this fix, although that may take a while because that would require a new release of the Twine application.

2. Open an instance of Chrome with the --allow-file-access-from-files parameter.
WARNING: Doing this will partially change the security of Chrome, I suggest not using this instance of Chrome to access content on the internet.

前面两种方法的链接:http://twinery.org/forum/discussion/4747/uncaught-securityerror-failed-to-execute-replacestate-on-history

3

 

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

 

4 $.mobile.pushStateEnabled = false; in the script
链接:http://stackoverflow.com/questions/32453806/uncaught-securityerror-failed-to-execute-replacestate-on-history-cannot-be

 

一点点感悟:外国的一些网站确实有时很有用,我以前很怕英文网站,现在正在开始尝试慢慢去看。---只为更好的自己

 

posted @ 2015-12-10 21:57  DJL箫氏  阅读(7281)  评论(2编辑  收藏  举报