title: PageVisibility HTML5 API on Safari
body: <p>I checked <a href="http://caniuse.com/#feat=pagevisibility" rel="nofollow">caniuse for pagevisibility support</a> and it states that Safari supports it.</p>
  
  <p>However, my Pagevisibility implementation does not work on Safari 9. It works everywhere else.</p>
  
  <p>See below:</p>
  
  <pre><code>document.addEventListener("visibilitychange", function() {
    if (document.hidden) {     
       function1();
    } else {
       function2();
    } 
  });
  </code></pre>
  
  <p>Is there a specific way to code (JS) PageVisbility in Safari? </p>