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 w
This is not a sure fire method, but typically a popup using window.open() does not direct to a new URL, so both windows will have the same href. Therefore, in many cases:
window.location.href == window.opener.location.href
will be true for a popup. So you could do:
var isPopup = (window.location.href == window.opener.location.href);
Like I said, this works in my limited tests, so there may be some feedback that shows where this won't be reliable.