A funny windows monitor ! visibilitychange

Profile picture of MikeHe-creator

Draft

Jun 22, 2024

·

1 min read

·

160 Views


When the user left the web page, you will find an interesting alter to complain to you:

This is how to work to attract the user as a small and unpopular web app:

window.addEventListener('visibilitychange', function() {
  if (document.visibilityState === "hidden") {
    //when you left the page
    alert('Cruel, heartless, you abandoned me alone! ☆*: .。. o(≧▽≦)o .。.:*☆')
  }else if (document.visibilityState === "visible") {
    //when you went back the page
    console.log('Master! Welcome, let me service to you ヾ(≧▽≦*)o');
  }
});

Profile picture of MikeHe-creator

Written By

Who-am-I?

No bio found