[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Check if window is popup or not

Posted on 2009-04-20
Medium Priority
Last Modified: 2013-11-19
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 !
Question by:blueshaolin
  • 2
  • 2
LVL 39

Accepted Solution

abel earned 2000 total points
ID: 24186112
if opener doesnt work, set a variable on the window:

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

then check for the presence of the isPopup variable on the window object (undefined or true) and you should be fine.

Author Comment

ID: 24189123
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


Author Closing Comment

ID: 31572305
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!
LVL 39

Expert Comment

ID: 24189200
glad you found it. Thanks for giving me the credits still for answering to the original q. :)

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month18 days, 22 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question