繁体   English   中英

window.open() 在 IE6 和 IE7 中不起作用

[英]window.open() is not working in IE6 and IE7

我有一个 dotnet 应用程序,我必须在其中关闭当前的 window,然后在运行时再次打开新的 window。 我已经使用了 Javascript 。 代码如下:

function OpenNewWindow() {
    if (ConfirmStartTest()) {
        closeWindow();

window.open("OnlineTestFrame.aspx", "_Parent", "model=yes,dailog=no,top=0,height=screen.height,width=screen.width,status=no,toolbar=no,menubar=no,location=no,zoominherit =0,resizable =no,scrollbars=yes,dependent=no,directories=no,taskbar=no,fullscreen=yes");

        self.focus();

    }

}

//taking the confirmation for starting test
function ConfirmStartTest() {
    var result = confirm("Do you want to start the test now?");
    return result;
}

//function to close the current window
function closeWindow() {

     //var browserName = navigator.appName;

     //var browserVer = parseInt(navigator.appVersion);

     var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;  

     if (ie7) 

           {     

           //This method is required to close a window without any prompt for IE7
           window.open('','_parent','');
           window.close();

           }

     else 

           {

           //This method is required to close a window without any prompt for IE6

           this.focus();

           self.opener = this;

           self.close();

           }
}

现在,当我在 IE7 和 IE6 中运行此应用程序时,它没有运行。 但是,在 IE8 中它运行良好。

此代码以前适用于所有 IE6 n IE7。 突然出现错误。它无法打开新的 window 并在黑白中突然停止。

如果anyonw对此有任何想法,请告诉我。

没有什么比关闭 window 并期待它之后的任何东西想要运行。

代码流程

  1. Function 称为
  2. 关闭 Window
  3. 打开 window <-- 如果父级关闭,我该如何运行?
  4. 焦点 window

[咆哮] 你在这里试图通过强迫用户使用你自己的弹出窗口 window 所以它没有 chrome 是非常糟糕的用户体验。 您正在删除用户历史记录。 不用管我的浏览器,你必须做一些骇人听闻的事情来关闭 window 是有原因的。 浏览器不允许您这样做。 [/咆哮]

这是由于self.opener的分配。

12/04 微软开始通过 Windows 更新推出安全公告 MS11-018 ,该更新关闭了与 memory 相关的几个漏洞 - 其中一个影响了无法再分配的opener属性。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM