| |

VerySource

 Forgot password?
 Register
Search
View: 1272|Reply: 1

On how to determine whether window.parent.opener is closed! !! !! !! !!

[Copy link]

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-19 23:00:02
| Show all posts |Read mode
function shutwin ()
{
     var wp = window.parent.opener;
        if (wp! = null&&typeof (wp)! = "undefined"&&! wp.closed)
        {
            if (wp.document.forms [0] .txtRefreshParent! = null)
            {
                wp.document.forms [0] .txtRefreshParent.value = "Refresh";
            }
            else
            {
               if (wp.document.forms [0] .ctl00_MainPlaceHolder_txtRefreshParent! = null)
               {
                   wp.document.forms [0] .ctl00_MainPlaceHolder_txtRefreshParent.value = "Refresh";
               }
            }
            wp.document.forms [0] .submit ();
        }
    window.parent.close ();
}
In fact wp is closed, but why is wp.closed equal to true, and typeof (wp) = "object", why? ? ?
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-30 16:30:01
| Show all posts
I have a similar problem

//Initialize, attach the pop-up window object to the global variable
//var timer;
var attach;
function initWin(obj){
attach = obj;
attach.focus();
//Set the time to execute the function regularly
timer=window.setInterval("IfWindowClosed()",500);
}

//Judge whether the window is closed
function IfWindowClosed() {
//alert();//If you run the alert, the following sentence will not prompt you without permission, you can run normally
if (attach.closed) {//This sentence prompts no permission
window.location=window.location;
window.clearInterval(timer);
attach = null;
}

}
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list