By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Page coming into focus event

P: n/a
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
Sep 11 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Steve Swift wrote:
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.
Sep 11 '08 #2

P: n/a
SAM
Steve Swift a écrit :
>
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
Sep 11 '08 #3

P: n/a
SAM
Stevo a écrit :
Steve Swift wrote:
>>
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 :-(

Sep 11 '08 #4

P: n/a
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.
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
Sep 12 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.