Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check whether a window is Popup or not?

This question is not the duplicate of if window is popup , But a similar one.

I am developing a extension which injects scripts to all web pages. I need to detect whether the window is popup or not.

Note: I am not the one who is opening the popup window, So the above solution won't work.

like image 593
Jeevan Avatar asked Apr 20 '12 04:04

Jeevan


People also ask

How do I identify a pop-up?

Pop-up Source IdentificationIf you see an address bar at the top of the window and the Firefox logo in the window's upper-left corner, Firefox is generating the pop-up. If you use another browser, such as Chrome, look for an address bar and the browser's logo in that pop-up.

How do I know if a popup is open?

In short, you can check if any element has ui-popup-active class. If there is, then you have popup open. Observe that, if popup is closed, it will have ui-popup-hidden class.

Is a pop-up a window?

A pop-up is a graphical user interface ( GUI ) display area, usually a small window, that suddenly appears ("pops up") in the foreground of the visual interface.


1 Answers

I've found that some browsers will set window.opener to window in certain cases. This is the most reliable popup check that I am using right now.

if (window.opener && window.opener !== window) {   // you are in a popup } 
like image 145
Steve Avatar answered Sep 28 '22 05:09

Steve