Unsafe JavaScript attempt to access frame with URL(window.open 子窗体得不到父窗体的句柄)
2010-12-14 11:25
411 查看
前几天在调试的时候 发现用window.open方法打开一个页面之后 在子窗体无法得到父窗体的句柄; 并且在chrome js即时窗口下输入地址报
Unsafe JavaScript attempt to access frame with URL
![](file:///C:/DOCUME~1/sina/LOCALS~1/Temp/moz-screenshot-1.png)
![](file:///C:/Documents%20and%20Settings/sina/%E6%A1%8C%E9%9D%A2/domain%E6%8A%A5%E9%94%99.png)
![](file:///C:/DOCUME~1/sina/LOCALS~1/Temp/moz-screenshot.png)
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 给改了。
Unsafe JavaScript attempt to access frame with URL
![](file:///C:/DOCUME~1/sina/LOCALS~1/Temp/moz-screenshot-1.png)
![](file:///C:/Documents%20and%20Settings/sina/%E6%A1%8C%E9%9D%A2/domain%E6%8A%A5%E9%94%99.png)
![](file:///C:/DOCUME~1/sina/LOCALS~1/Temp/moz-screenshot.png)
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 给改了。
相关文章推荐
- Unsafe JavaScript attempt to access frame with URL https://xxx with URL http://xxx.
- Unsafe JavaScript attempt to access frame with URL
- 伪跨域 Unsafe JavaScript attempt to access frame
- javascript宿主对象之window.screen、window.close()/open()、window.moveTo、window.resizeTo
- 解决HibernateException: Illegal attempt to associate a collection with two open sessions
- net.sf.hibernate.HibernateException: Illegal attempt to associate a collection with two open session
- How to open a web site with the default web browser in a NEW window
- JavaScript基础 window.open(url,name,options) 没有菜单栏,没有工具栏
- javascript中window窗体对象open()和showModalDialog()用法
- JavaScript基础 window.open(url,name,options) 没有菜单栏,没有工具栏
- SSH架构中Illegal attempt to associate a collection with two open sessions 问题
- 解决HibernateException: Illegal attempt to associate a collection with two open sessions
- 解决HibernateException: Illegal attempt to associate a collection with two open sessions
- Hibernate Merge (Illegal attempt to associate a collection with two open sessions)
- OpenSessionInViewFilter的两个异常:Illegal attempt to associate a collection with two open sessions
- JavaScript基础 window.open(url,name,options) 在新打开的窗口中写一些文字
- JavaScript基础 window.open(url,name,options) 在新打开的窗口中写一些文字
- Illegal attempt to associate a collection with two open sessions
- Illegal attempt to associate a collection with two open sessions
- 【PB】pb打开pbw时提示Attempt to open datawindow failed错误解决办法