I hate “exit intent” popups. The kind that automatically open when your mouse leaves the page begging “please don’t go!”. They’re annoying. They’re irrelevant (I’m often following a tutorial, not closing the tab). They interrupt the content I’m trying to read. So I made a short Userscript to globally block them.
While researching I was able to block the modals per-website using uBlock Origin’s script:inject(…). Specifically the addEventListener-defuser.js is used in some filters to prevent JS click popups. Unfortunately the script injection intentionally doesn’t accept wildcards so I can’t use it globally.
I made a Userscript to do the same thing and it’s working for Greasemonkey and Tampermonkey. This runs on all http and https pages and overrides the mouseleave and mouseout events. If some popup still appear try adding //@run-at document-start so that it registers earlier. It will probably break some UIs but it’s an acceptable tradeoff to me. URLs can be excluded if needed. I don’t really plan on supporting such a simple script so it’s “licensed” under 0BSD. You’re free to use, copy, and edit. Have fun:
EDIT: I’ve found a few features that broke. Excludes have been added.
- YouTube’s preview on the seek bar doesn’t go away.
- Wikipedia’s reference hover popup.