Unsafe JavaScript attempt to access frame with URL

Unsafe JavaScript attempt to access frame with URL(window.open 子窗體得不到父窗體的句柄)

前幾天在調試的時候 發現用window.open方法打開一個頁面之後  在子窗體無法得到父窗體的句柄; 並且在chrome js即時窗口下輸入地址報
 
 
Unsafe JavaScript attempt to access frame with URL
 
 
 
2 Unsafe JavaScript attempt to access frame with URL http://live.beta.v.sina.com.cn/js2/p2pService/popwindow.html from frame with URL http://live.beta.v.sina.com.cn/client4/index.php?rid=5 . Domains, protocols and ports must match.
 
document.domain = 'a';  // 改之前
document.domain = 'b';  // 改之後
 
最終發現時由於在父窗體的頁面打開之後 把當前的域名給改了,document.domain = 'b';
 
但是新彈出的頁面還是的domain 還是 改之前的'a';
 
所以在彈出的子窗體中就因爲安全問題而得不到父窗體的句柄;
 
 
 
 
 
如果你也碰見在彈出的子窗體得不到父窗體的句柄, 仔細看看父窗體是不是有把domain,protocol,port 給改了。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章