I’m working on a Chrome extension and I’m looking how to find out (from the background page) if the popup page is open or not. I looked into message passing but I’m not sure if that’s gonna help me at this or if there’s a simpler way.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the following chrome API call from your background page fetch if the popup view is open:
If it returns an empty array then your popup is not open, if it returns an array with your popups DOMWindow object, then your popup is open.
If you have multiple popups in one plugin then you could check for the existence of some global variable in the returned DOMWindow to disambiguate.