Javascript popup window refresh'ing?

J

Jeppe bob Dyrby

I have a page that automaticly opens a small popup window, but it is
only supposed to open this window once. A little info:

function openwindow(name_var) {
if (!name_var) {
name_var = window.open(...);
}
}

First of: Is that at all posible? To have a variable that holds the
name of the new window, and if that variable is not set, then open the
window, and will the new window opened have the name of the content of
the variable (confused? so am I)...

OR:

Can I, in the new window, do so it is imposible to refresh that
window, 'cause it refreshes when the top function tries to open it
again...?

Hope this was enough info, otherwise I'd be glad to write some more...

Hopefully I can get som help on this topic.

Thank's in advance.

- Jeppe
 
C

Camazing.com

Not exactly sure what your asking, but if you have a window open and then
open another window with the same name, it will put the new page in the
window with the same name . If there is not a window with that name, it will
create a new one.
 
J

Jeppe bob Dyrby

Hmm... I wasn't totally clear then :p
Is there any way to stop the browser from openening a popup with the
same name as one that already exists?
If, for example: The opener window tries to open a popup window, but
there's already one with the same name, as the one it tries to open,
can I stop it from openening the same page in the same popup window?

- Hope that was a bit more info... :)
- Jeppe
 
R

Richard Cornford

Jeppe said:
Hmm... I wasn't totally clear then :p
Is there any way to stop the browser from openening a popup with the
same name as one that already exists?

Broadly no, in a practical sense, yes. That is, if you opened the
windows and gave them names then you are in a potion to record what you
have done and examine the references to those windows to see if they
have been closed or are still open, and make decisions about how to act
based on that information. However, if a window with an identical name
has already been created (say by a previous page/site) then you will not
know anything about it (and probably won't care much either).
If, for example: The opener window tries to open a popup window, but
there's already one with the same name, as the one it tries to open,
can I stop it from openening the same page in the same popup window?
Yes.

- Hope that was a bit more info... :)

It is more information, but whether it is enough information is another
matter. People write code to specifications, which are specific. If you
want to be told how to do something you will have to try to be specific
about what it is you want to do (and probably why). As it is, we get to
the point of determining that a window with a given name has been opened
and a URL loaded, and determine that it is still open, and so "stop it
from openening the same page in the same popup window", but does that
mean that the code is expected to just do nothing, or is the idea to
open a new URL in a distinct window?

But opening pop-up windows is not necessarily that good an idea to start
with due to the existence of diverse pop-up blocking mechanisms. Some
idea of the context of the application would allow for an assessment of
the significance of pop-up blocking (and accompanying required
additional testing) along with the proposition of alternative
approaches.

<snip top-post>

Please don't top post to comp.lang.javascirpt (see the FAQ).

Richard.
 

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
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top