2

I know that we can close a default_popup using window.close() but i need to close the popup when user taps on outside. I was not able to get any documentation about it in the console.

"browser_action":{
    "default_popup":"auth_popup.html"
},
Manoj Perumarath
  • 9,337
  • 8
  • 56
  • 77
  • The popup is closed automatically when the user clicks the browser window outside of the popup. If you want to detect a click outside of the *entire browser window* you can try using [chrome.windows.onFocusChanged](https://developer.chrome.com/extensions/windows.html#event-onFocusChanged) listener. – wOxxOm Mar 26 '19 at 17:29
  • No it's not dismissing when I click outside the popup, however it get dismiss when I execute window.close on a button inside popup – Manoj Perumarath Mar 26 '19 at 17:42
  • In that case it must be OS-specific behavior as it works as noted in Windows. If chrome.windows.onFocusChanged approach won't work for this case then the only solution would be to write a separate utility to monitor system-wide mouse clicks and invoke it via [nativeMessaging API](https://developer.chrome.com/extensions/nativeMessaging.html). – wOxxOm Mar 26 '19 at 17:45
  • The popup will not close automatically if you have the dev tools open. – jezmck Jun 16 '23 at 09:22

0 Answers0