javascript - How can I detect a user about the exit the page? -


i detect when user exit page, before click button, , - example display popup. not want prevent user leaving page, grab attention again.

this done optin monster, want implement myself.

where start?

edit: beforeunload fired after user clicked or x button. catch exit intent, example when mouse moving towards button, before clicked.

ouibounce this. there live demo here.

npm install ouibounce 

then:

var ouibounce = require('ouibounce'); var modal = document.getelementbyid('ouibounce-modal') ouibounce(modal); 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -