Check if window is popup or not

Hi, I need to detect if the current window is a popup or not.

 I think opener won't work for me since I have already browsed some links in the window and I always get 'main window' after checking opener.

Thanks in advance !
Who is Participating?
abelConnect With a Mentor Commented:
if opener doesnt work, set a variable on the window:

var mywindow = (....);
mywindow.isPopup = true;

then check for the presence of the isPopup variable on the window object (undefined or true) and you should be fine.
blueshaolinAuthor Commented:
Thanks..... the problem was that the 'current window' is in a frame, so the opener isn't really the Main page.

Solution: check window.parent.opener

blueshaolinAuthor Commented:
I didn't give enough information since I didn't know the page/window was a frame. The solution to the given problem is right!
glad you found it. Thanks for giving me the credits still for answering to the original q. :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.