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

in popup window, checking if page in opener window - any help?

P: n/a
Hi,

I have a little test script in a pop up window. The pop up page
refreshes every 2 seconds. I want it to check with every refresh if a
certain page (log3.htm) is loaded in the opener window. If that is the
case, another page (log4.htm) must be loaded in the opener window.

In pop up page:

<script>
<!--
if (opener.location.href="log3.htm")
{opener.location.replace("log4.htm")}
//-->
</script>

But it aint working :( What happens is that the condition doesn't work,
because with *any* page in the opener window, it is replaced immediately
with log4.htm when the pop up refreshes - log4.htm should only be
loaded automatically when log3htm is in the opnener window. So pop up
and opnener parent do communicate.. but just not as I'd like them.
Anyone??

*&%$
Thnx
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
In article <42**********************@dreader2.news.tiscali.nl >,
ma************@hotmail.com enlightened us with...

<script>
<!--
if (opener.location.href="log3.htm")


Fundamental error.
=
==
The first assigns.
The second compares.
if (opener.location.href=="log3.htm")

--
--
~kaeli~
The more ridiculous a belief system, the higher probability
of its success.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2

P: n/a
JPL Verhey wrote:
if (opener.location.href="log3.htm")
The comparison operator is "==", not "=".
{opener.location.replace("log4.htm")} with *any* page in the opener window, it is replaced
immediately with log4.htm when the pop up refreshes


The assignment you accidentally typed always evaluates to "true" since
you assign a string that's not the null string. In addition, the href
property will most likely contain more than "log3.htm" (protocol,
hostname, and path info), and you should look if the opener window is
still there:

if (
opener
&& !opener.closed
&& opener.location.replace
&& opener.location.href.match(/log3\.htm$/)
)
opener.location.replace("log4.htm");

ciao, dhgm
Jul 23 '05 #3

P: n/a

"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <42**********************@dreader2.news.tiscali.nl >,
ma************@hotmail.com enlightened us with...

<script>
<!--
if (opener.location.href="log3.htm")


Fundamental error.
=
==
The first assigns.
The second compares.
if (opener.location.href=="log3.htm")


Ok thanks! Wasn't aware of that.

Jul 23 '05 #4

P: n/a
The below works! Brilliant, thanks alot..

"Dietmar Meier" <us***************@innoline-systemtechnik.de> wrote in
message news:37*************@individual.net...
JPL Verhey wrote:
if (opener.location.href="log3.htm")


The comparison operator is "==", not "=".
{opener.location.replace("log4.htm")}

with *any* page in the opener window, it is replaced
immediately with log4.htm when the pop up refreshes


The assignment you accidentally typed always evaluates to "true" since
you assign a string that's not the null string. In addition, the href
property will most likely contain more than "log3.htm" (protocol,
hostname, and path info), and you should look if the opener window is
still there:

if (
opener
&& !opener.closed
&& opener.location.replace
&& opener.location.href.match(/log3\.htm$/)
)
opener.location.replace("log4.htm");

ciao, dhgm

Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.