Check whether a window is Popup or not?

前端 未结 10 1406
夕颜
夕颜 2020-12-08 20:23

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

10条回答
  •  既然无缘
    2020-12-08 20:36

    Why not just check if the opener is NOT undefined? a popup has an opener while a regular page hasn't.

    if (window.opener != null) 
    

提交回复
热议问题