I'm trying to get a solution that detects when a tab/page has lost/gained focus. It needs to be consistent across Android Chrome, Windows Surface IE and iOS Safari. Focus and Blur seemed to throw up some pretty inconsistent results, and then I stumbled on to PageVisibility API.
It seems to work for everything I need, except when pressing the 'Home' button on iOS. Reopening Safari shows that no events have been fired. Does anyone have a solution that covers this test case?
Here is an example I was using for testing - specifically the Textarea about half way down the page: http://www.html5rocks.com/en/tutorials/pagevisibility/intro/