468,107 Members | 1,309 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,107 developers. It's quick & easy.

how to know whether the webpage is the top active IE window with javascript code

hi all ;
I am new guy!
I need to know whether the webpage is the top active IE window
with javascript in the webpage,when I open 2 or more IE window.
tks in advance!
victor.zou

Mar 31 '07 #1
3 2444
On Sat, 31 Mar 2007 03:57:14 +0200, victorzou <vi********@hotmail.com
wrote:
hi all ;
I am new guy!
I need to know whether the webpage is the top active IE window
with javascript in the webpage,when I open 2 or more IE window.
tks in advance!
victor.zou
What if the user is browsing with Opera or Firefox? Don't you want to know
whether the web page is the topmost in those cases as well? Or do you only
need to know it if the user is browsing with MSIE?

Other than that, figuring out which window is the active topmost on a
user's computer can probably be figured out using window.onfocus() or
document.onfocus().

Haven't tested this:

<html>
<body onfocus="alert('Hello, world!')">
<p>Hello, world!</p>
</body>
</html>

then when switching between different browser windows with the same page,
each page should alert.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Mar 31 '07 #2
OmegaJunior said the following on 3/31/2007 1:30 PM:
On Sat, 31 Mar 2007 03:57:14 +0200, victorzou <vi********@hotmail.com>
wrote:
>hi all ;
I am new guy!
I need to know whether the webpage is the top active IE window
with javascript in the webpage,when I open 2 or more IE window.
tks in advance!
victor.zou

What if the user is browsing with Opera or Firefox?
That wasn't the question, now was it?
Don't you want to know whether the web page is the topmost in
those cases as well?
Obviously not or the question would/could have been worded differently.
Or do you only need to know it if the user is browsing with MSIE?
That appears to be what was asked. Perhaps it could even be an MSIE
Intranet situation where no other browser is used.

Other than that, figuring out which window is the active topmost on a
user's computer can probably be figured out using window.onfocus() or
document.onfocus().
Or probably not. Try reading the question again.
Haven't tested this:
Perhaps you should. And then follow your own advice in another thread:
<quote>
First: please to validate your page using a decent validator. Try this one:
http://validator.w3.org/
</quote>
<html>
<body onfocus="alert('Hello, world!')">
<p>Hello, world!</p>
</body>
</html>

then when switching between different browser windows with the same
page, each page should alert.
And that still doesn't answer the question that was asked.

BTW, your posting agent is broken.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 31 '07 #3
On Sat, 31 Mar 2007 20:16:49 +0200, Randy Webb <Hi************@aol.com
wrote:
OmegaJunior said the following on 3/31/2007 1:30 PM:
>On Sat, 31 Mar 2007 03:57:14 +0200, victorzou <vi********@hotmail.com
wrote:
>>hi all ;
I am new guy!
I need to know whether the webpage is the top active IE window
with javascript in the webpage,when I open 2 or more IE window.
tks in advance!
victor.zou
What if the user is browsing with Opera or Firefox?

That wasn't the question, now was it?
>Don't you want to know whether the web page is the topmost in those
cases as well?

Obviously not or the question would/could have been worded differently..
>Or do you only need to know it if the user is browsing with MSIE?

That appears to be what was asked. Perhaps it could even be an MSIE
Intranet situation where no other browser is used.

>Other than that, figuring out which window is the active topmost on a
user's computer can probably be figured out using window.onfocus() or
document.onfocus().

Or probably not. Try reading the question again.
>Haven't tested this:

Perhaps you should. And then follow your own advice in another thread:
<quote>
First: please to validate your page using a decent validator. Try this
one:
http://validator.w3.org/
</quote>
><html>
<body onfocus="alert('Hello, world!')">
<p>Hello, world!</p>
</body>
</html>
then when switching between different browser windows with the same
page, each page should alert.

And that still doesn't answer the question that was asked.

BTW, your posting agent is broken.
Then please enlighten us and explain how the question can be interpreted
differently?

My posting agent broken? How so?
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Apr 1 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by Mary Catherine | last post: by
9 posts views Thread by Christopher Benson-Manica | last post: by
3 posts views Thread by Atul | last post: by
2 posts views Thread by Martin \(Martin Lee\) | last post: by
14 posts views Thread by =?Utf-8?B?UGF1bA==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.