views:

27

answers:

1

Hello,

Could you tell me how to do a autorefresh (every minute) on a page. But I have some constraints, the refresh occur only when : - the browser is not reduce (minimized) - the tab must be active

When the browser is restored do a refresh, if the page with the refresh is active.

Sample : I have 2 tabs, one on "YouToube" and the other on myapplication, there is a refresh only if the myapplication's tab is active

Do you have an idea ?

Thanks,

+2  A: 

You can accomplish it by using windows.blur() and windows.focus()

http://codepunk.hardwar.org.uk/ajs04.htm

Codler