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

 

一點點感悟:外國的一些網站確實有時很有用,我以前很怕英文網站,現在正在開始嘗試慢慢去看。---只為更好的自己

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM