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 给改了。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章