Answers for "a popup when the user leaves teh website"

0

a popup when the user leaves teh website

staying_in_site = false;

Event.observe(document.body, 'click', function(event) {
  if (Event.element(event).tagName == 'A') {
    staying_in_site = true;
  }
});

window.onunload = popup;

function popup() {
  if(staying_in_site) {
    return;
  }
  alert('I see you are leaving the site');
}
Posted by: Guest on February-06-2021

Code answers related to "a popup when the user leaves teh website"

Browse Popular Code Answers by Language