Blocking exit intent popups

Frig off, Randy


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 following instructions, not closing). They interrupt the content I’m trying to read. So I made a short Userscript to globally block them.

Soon to be blocked

Specifically I want to block Ouibounce (demo) and OptIn Monster (demo). Bounce Exchange is another infamous one but I couldn’t find a demo to test on. This Metafilter topic tipped me off to the main culprits: Javascript’s mouseleave and mouseout events. So many sites have these popups that it’s not practical to block on a site-by-site basis. Disabling all Javascript is too heavy handed.

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.

Add a Comment

Your email address will not be published. Required fields are marked *