Testing if a component is visible on screen?

The general question: How do I determine whether a GUI element, e.g. a table is currently visible. It may be invisible due to the component being in a tab in the page which is not selected, being in a browser tab that is not selected, being in a browser window that is hidden behind other windows, being in a browser window that is minimized, and probably some more. I want to cover as many cases as possible.

My concrete problem: I have a table which is based on data from the server which changes frequently. I use a Refresher widget to update the table in regular intervals. This refresh can have a noticeable impact on the browser as the query can sometimes take a bit until it returns. This is acceptable as long as the user is using my webapp, but slightly annoying when my page is not visible as it still delays browser responsiveness. I’d like to improve this by not querying an update from the server when my table is not visible. How do I determine whether my table is visible or not?



A valid need, but I’m pretty sure not all of those cases can be covered in a web app. No way to know if some other window is on top of it or not.

Focus/blur listeners could be used to indicate whether or not your application is the active window, but that might prove to be troublesome, too.