Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. if ("hidden" in document && "visibilityState" in document) {
  2. document.addEventListener("visibilitychange", onVisibilityChange);
  3. onVisibilityChange();
  4. } else {
  5. console.log("This browser doesn't support Page Visibility API");
  6. }
  7.  
  8. function onVisibilityChange() {
  9. console.log("This page is " + document.hidden ? "hidden" : "visible");
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement