verify popup window is open from multiple pages

A

anthony.turcotte

Hi,

I've looked for a solution to this problem on google, read posts in
this newsgroup and I still haven't found anything that could help me.

Here's the scenario.

1. User accesses pageA.html
2. User clicks on menu link to open popup.html
3. pageA.html checks if popup.html is already open. It is not, open
popup.html.
4. User switches back to pageA.html (does not close popup.html)
5. User clicks menu link for pageB.html.
6. System displays pageB.html
7. User clicks menu to open popup.html
8. pageB.html checks if popup.html is already open. If it is, focus is
made on popup.html. If it isn't, popup.html is opened.

Anyone can help?

Much appreciated,
Anthony.
 
A

anthony.turcotte

Ian said:
With what? Please quote the context you are replying to. See
<http://cfaj.freeshell.org/google/>.

If you post the code you are having trouble with, you might get some help.


Sorry for the newbiness. :)

Here was my original query.
-----

Hi,
I've looked for a solution to this problem on google, read posts in
this newsgroup and I still haven't found anything that could help me.

Here's the scenario.

1. User accesses pageA.html
2. User clicks on menu link to open popup.html
3. pageA.html checks if popup.html is already open. It is not, open
popup.html.
4. User switches back to pageA.html (does not close popup.html)
5. User clicks menu link for pageB.html.
6. System displays pageB.html
7. User clicks menu to open popup.html
8. pageB.html checks if popup.html is already open. If it is, focus is
made on popup.html. If it isn't, popup.html is opened.

Anyone can help?

Much appreciated,
Anthony.
 
R

Randy Webb

(e-mail address removed) said the following on 5/20/2006 1:09 PM:
Sorry for the newbiness. :)

Here was my original query.
-----

Hi,
I've looked for a solution to this problem on google, read posts in
this newsgroup and I still haven't found anything that could help me.

Here's the scenario.

1. User accesses pageA.html
2. User clicks on menu link to open popup.html

User's pop up blocker doesn't allow that page to open, but okay.

But, does it get opened via target= or by window.open?
3. pageA.html checks if popup.html is already open. It is not, open
popup.html.

Use the same name in the name/target, the browser will handle the rest.
4. User switches back to pageA.html (does not close popup.html)
5. User clicks menu link for pageB.html.
6. System displays pageB.html
7. User clicks menu to open popup.html
8. pageB.html checks if popup.html is already open. If it is, focus is
made on popup.html. If it isn't, popup.html is opened.

You will run into problems trying to focus a popup and bring it to the
front. But again, you use the same name/target in the code and the
browser will handle the rest.
 
A

anthony.turcotte

Randy said:
(e-mail address removed) said the following on 5/20/2006 1:09 PM:

User's pop up blocker doesn't allow that page to open, but okay.

But, does it get opened via target= or by window.open?

I use window.open (would I be better off with target= ?), and I thought
that a popup blocker wouldn't mind because it was user action that
brought the popup to life. Anyhow, I haven't seen a popup blocker
mind... yet. :)
Use the same name in the name/target, the browser will handle the rest.

If the popup is already opened and I use the same name/target, it will
refresh the popup. Let's say the content of the popup has changed since
its original creation; in that case, I don't want the popup window to
be "re-opened" over the current content. So how do I go about doing
that?
You will run into problems trying to focus a popup and bring it to the
front. But again, you use the same name/target in the code and the
browser will handle the rest.

Likewise, given the popup is already opened, I haven't found a way to
"only" focus the window, without refreshing it/loading content inside.
My problem seems to be that as I navigated to pageB.html, I've lost the
reference on the popup.html window; more importantly, I can't find a
way to simply get that reference, without loading any content in the
popup window if it exists.

Maybe I'm missing something... thanks for taking the time!
Anthony.
 
R

Randy Webb

(e-mail address removed) said the following on 5/20/2006 1:50 PM:
I use window.open (would I be better off with target= ?), and I thought
that a popup blocker wouldn't mind because it was user action that
brought the popup to life. Anyhow, I haven't seen a popup blocker
mind... yet. :)

Ever seen the way that Symantec's Norton blocks popups? It redefines the
window.open call by script and injects it in the page before any other
content. It will stop a window.open call dead in it's tracks - user
initiated or not.

var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes)
{
return (new Object());
}
window.open = SymWinOpen;


Test that with your popup code :)
If the popup is already opened and I use the same name/target, it will
refresh the popup.

Only if it is the same page.
Let's say the content of the popup has changed since its original
creation; in that case, I don't want the popup window to be "re-opened"
over the current content. So how do I go about doing that?

The popup won't be "re-opened", it is reused.
Likewise, given the popup is already opened, I haven't found a way to
"only" focus the window, without refreshing it/loading content inside.

You can't. Not short of closing it and reopening it and then hoping it
stays in the front.
My problem seems to be that as I navigated to pageB.html, I've lost the
reference on the popup.html window; more importantly, I can't find a
way to simply get that reference, without loading any content in the
popup window if it exists.

The second parameter to window.open is the name of that window.

window.open(URL,winName,parameters)

<a href="someURL" target="winName">Some Page</a>

Open that first popup, then click the link. See where it loads at...
 
A

anthony.turcotte

Randy said:
(e-mail address removed) said the following on 5/20/2006 1:50 PM:

Ever seen the way that Symantec's Norton blocks popups? It redefines the
window.open call by script and injects it in the page before any other
content. It will stop a window.open call dead in it's tracks - user
initiated or not.

var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes)
{
return (new Object());
}
window.open = SymWinOpen;


Test that with your popup code :)


Only if it is the same page.


The popup won't be "re-opened", it is reused.


You can't. Not short of closing it and reopening it and then hoping it
stays in the front.


Baaah, there we have it. I can't. I'll have to find a way to do this in
another way...
The second parameter to window.open is the name of that window.

window.open(URL,winName,parameters)

<a href="someURL" target="winName">Some Page</a>

Open that first popup, then click the link. See where it loads at...


Thanks a lot for your time,
Anthony.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top