JavaScript Page Visibility
// http://daker.me/2013/06/5-html5-javascript-apis-to-keep-an-eye-on.html
document.addEventListener('visibilitychange', function(e) {
console.log('hidden:' + document.hidden,
'state:' + document.visibilityState)
}, false);