Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > in popup window, checking if page in opener window - any help?

Reply
Thread Tools

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

 
 
JPL Verhey
Guest
Posts: n/a
 
      02-14-2005
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


 
Reply With Quote
 
 
 
 
kaeli
Guest
Posts: n/a
 
      02-14-2005
In article <4210bed5$0$44109$ >,
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

 
Reply With Quote
 
 
 
 
Dietmar Meier
Guest
Posts: n/a
 
      02-14-2005
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
 
Reply With Quote
 
JPL Verhey
Guest
Posts: n/a
 
      02-14-2005

"kaeli" <> wrote in message
news:...
> In article <4210bed5$0$44109$ >,
> 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.



 
Reply With Quote
 
JPL Verhey
Guest
Posts: n/a
 
      02-14-2005
The below works! Brilliant, thanks alot..

"Dietmar Meier" <> wrote in
message news:...
> 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
window.opener, form.opener? jojowebdev@gmail.com Javascript 5 07-14-2006 07:08 PM
popup window close to submit opener window without 'causes validation' happening Matt Jensen ASP .Net 1 12-16-2005 03:16 PM
Save Data in Database; reload opener window from Popup window ASP. =?Utf-8?B?Sko=?= ASP .Net 1 10-12-2004 07:23 PM
refreshing main opener window from a second (popup) window sentinel Javascript 1 02-16-2004 01:56 PM
trigger event on opener from popup when closing it or run opener script from popup Urs Gubler Javascript 0 07-02-2003 02:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57