The thing about the page visibility API is that it doesn't really tell you if the page is actually visible or not. It just tells you if the page is in a background tab or (I think) minimized, but it won't tell you if the web page is completely hidden by another window.