Checks If Browser Tab & Browser Window Gain Or Lose Focus Using The HTML5 Visibility API

TAB FOCUS TAB BLUR WINDOW FOCUS WINDOW BLUR

To Test :

  1. First click inside the Preview panel so the page gains focus ( very important )
  2. Switch between tabs
  3. Give another program (or one of the CodePen editor panels) focus and come back to the browser
  4. Look at the above state changes.