【发布时间】:2012-03-16 19:44:47
【问题描述】:
main.php 有
<a href="redirect.php" target="_blank">open new window</a>
那么redirect.php有
top.top.location.href='http://xx.com/index.html';
当我点击链接打开新窗口时,redirect.php 在新窗口中打开并重定向http://xx.com/index.html。问题就在这里:在这个页面中,一个javascript代码强制关闭这个新窗口并将主窗口重定向到http://xx.com/index.html。
javascript代码http://xx.com/index.html有:
try{
if(opener) {
opener.location.href=this.location.href;
top.close();
}
}
如何防止主页面被子窗口关闭?
【问题讨论】:
-
对你的问题多加努力。这没有任何意义。
-
好的,我提供了更多细节。
标签: javascript window self window.opener