views:

31

answers:

3

I left the page or browser for a while and come back to the page after a while. Is there any event for the re-focus?

A: 

Yes, you can detect a blur and focus event on the window object in most browsers.

Pat
A: 

I am not sure what exactly you mean by coming back to page but, you can use:

<body onfocus="yourjsfunction();">

or:

<body onmouseover="yourjsfunction();">
Musa Hafalır
A: 

Not sure if this works in all browsers, but

document.focus = function() {
   //stuff to do
}
wheresrhys