The jQuery Page Visibility API allows you to check the websites browser tab visibility state.