开发者

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

I have a dotnet application in which I have to close the current window and then open the new window again in runtime. I have used Javascript for it. The code is as follows:

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,depen开发者_Python百科dent=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();

           }
}

Now, when I am running this application in IE7 and IE6, it is not running. But, in IE8 it is running fine.

This code was working fine for all IE6 n IE7 previously. All of a sudden it is giving error.Its not able to open the new window and stopping abruptly in b/w.

If anyonw has any idea regarding this, please let me know.


This is due to the assignment of self.opener.

12/04 Microsoft started pushing out Security Bulletin MS11-018 via Windows Update which closed of several vulnerabilities related to memory - one of these affected the opener property which no longer can be assigned to.


Nothing like closing a window and expecting anything after it to want to run.

Flow of the code

  1. Function called
  2. Close Window
  3. Open window <-- How can I run if parent is closed?
  4. Focus window

[rant] What you are trying to do here by forcing a user to use your own pop up window so it has no chrome is very bad user experience. You are deleting a users history. Leave my browser alone! There is a reason why you have to do hacky stuff to close a window, the browsers do not allow you to do it. [/rant]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜