1. 程式人生 > >Uncaught DOMException: Blocked a frame with origin "http://127.0.0.1" from accessing a cross-origin

Uncaught DOMException: Blocked a frame with origin "http://127.0.0.1" from accessing a cross-origin

我瀏覽自己tomcat上網頁用的localhost,訪問的子頁面用的127.0.0.1,

所以只要瀏覽器中的localhost改為127.0.0.1就好了

下面是別人出現的類似錯誤,敲黑板,做筆記。

iframe子頁面呼叫父頁面方法 跨域 異常 Blocked a frame with origin

Blocked a frame with origin "http://127.0.0.1:8080" from accessing a frame with origin "http://localhost:8080".Protocols, domains, and ports must match.

這個是因為你的父頁面和子頁面不在同一個域下做成的。如這裡父頁面是在http://localhost:8080,而子頁面在http://127.0.0.1:8080下,更改一下路徑就可以了。

以上就是iframe子頁面呼叫父頁面方法 跨域 異常 Blocked a frame with origin的全文介紹,希望對您學習和使用html網頁基礎有所幫助.