Connecting Tech Pros Worldwide Forums | Help | Site Map

Page coming into focus event

Steve Swift
Guest
 
Posts: n/a
#1: Sep 11 '08
I've asked this before, and last time the answer was "not possible".
Maybe some more clever people are hanging around this time:

Is there a way to trigger a routine when a page gets the "focus"? I'm
thinking of when you switch to a page in a tabbed browser.

Don't ask me what I'm going to do in such an event. It is no more
interesting than knowing what I plan to do when I leave my house. (Put
the milk bottles out)

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk

Stevo
Guest
 
Posts: n/a
#2: Sep 11 '08

re: Page coming into focus event


Steve Swift wrote:
Quote:
I've asked this before, and last time the answer was "not possible".
Maybe some more clever people are hanging around this time:
>
Is there a way to trigger a routine when a page gets the "focus"? I'm
thinking of when you switch to a page in a tabbed browser.
>
Don't ask me what I'm going to do in such an event. It is no more
interesting than knowing what I plan to do when I leave my house. (Put
the milk bottles out)
My first thought turned to mousemove events. Not sure if you get them
when your window doesn't have focus. Not forgetting of course that the
window can still be visible even if it doesn't have current focus.
SAM
Guest
 
Posts: n/a
#3: Sep 11 '08

re: Page coming into focus event


Steve Swift a écrit :
Quote:
>
Is there a way to trigger a routine when a page gets the "focus"? I'm
thinking of when you switch to a page in a tabbed browser.
It was a time where :

<body onfocus="putOut('milk bottles');">

worked

Seems stil working with my Firefox


--
sm
SAM
Guest
 
Posts: n/a
#4: Sep 11 '08

re: Page coming into focus event


Stevo a écrit :
Quote:
Steve Swift wrote:
Quote:
>>
>Is there a way to trigger a routine when a page gets the "focus"? I'm
>thinking of when you switch to a page in a tabbed browser.
>
My first thought turned to mousemove events. Not sure if you get them
when your window doesn't have focus. Not forgetting of course that the
window can still be visible even if it doesn't have current focus.

visible != focus

so ... no importance



window.onfocus = function() { alert('focus'); };
</script>

or :
<body onfocus="alert('focus');">


Very funny with my Opera :-(

Steve Swift
Guest
 
Posts: n/a
#5: Sep 12 '08

re: Page coming into focus event


Is there a way to trigger a routine when a page gets the "focus"? I'm
Quote:
thinking of when you switch to a page in a tabbed browser.
In the Opera Community forums I was pointed at window.onfocus which is
just what I was looking for.

The fact that I can't make it do what I want it to is my problem. I
think there are conditions when the event triggers before the page has
loaded, so attempting to manipulate controls which are not yet present
fails.

--
Steve Swift
http://www.swiftys.org.uk/swifty.html
http://www.ringers.org.uk
Closed Thread


Similar JavaScript / Ajax / DHTML bytes