• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1676
  • Last Modified:

How to check if popup window is focused in JavaScript?

Hello,

If we have a popup window open and it is not in focus how can we check it? If the popup is not in focus and the user is looking at something else I want to play a "beep" sound using <embed>. However if they are focused on the popup I do not wan to play this "beep" sound.

To explain in further detail I have a Instant Messenger running and if the user does not have the IM focused and they get a new message there is no way in letting them know. So I thought a "beep" sound would be nice. I found a way to simply focus() the window, however don't think many will like that.

Any help would be appreciated.

Thank you
0
iamnatio
Asked:
iamnatio
  • 2
1 Solution
 
samic400Commented:
0
 
samic400Commented:
I know I've written web apps to play sounds if certain conditions appear with:

<bgsound src='mysound.wav' loop='3' />

and it works great.
0
 
iamnatioAuthor Commented:
Thank you very much, just what I was looking for.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now