473,320 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

browsers' differences in action on same code.

This code works perfectly in IExplorer, but in exactly the same context
does not work at all in Netscape 7.x.

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
if (window.parent.opener.closed)
{
window.parent.close();
};
// -->
</SCRIPT>

This is intended to detect the presence of an open parent window. When
one closes the open parent in IE, the child closes promply. In Netscape,
the inner loop is apparently not executed after the window is closed.
Reversing the logic on the opener test works fine as long as the window
is open. But, hey! Isn't ...opener.closed supposed to return something
if a window is closed? It seems to simply... fail. The inner loop will
not execute with either a negative or positive logic spin (!window...).

--
***********************************
* Bob Dickow (di****@uidaho.edu) *
* Hampton School of Music *
***********************************
Jul 20 '05 #1
4 4530
Robert Dickow wrote:
This code works perfectly in IExplorer,
Sure? Maybe you have disabled the display of script errors.
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
if (window.parent.opener.closed)
{
window.parent.close();
};
// -->
</SCRIPT>

This is intended to detect the presence of an open parent window. When
one closes the open parent in IE, the child closes promply.
Where is the event that triggers the above code?
In Netscape, the inner loop is apparently not executed
There is no (`if') loop! `if' is a conditional statement
and you defined a block of statements with `{...}' to be
executed if it evaluates to `true'.
after the window is closed.


Try

function foobar()
{
if (window.parent
&& window.parent.close
&& (!window.parent.opener || window.parent.opener.closed))
window.parent.close();
}

and use the `unonload' event handler of the `body' element to call that
function. Note that the event also fires when the user displays another
document in the same window.
PointedEars

Jul 20 '05 #2
(Have canceled my other posting, please consider it obsolete.)

Robert Dickow wrote:
This code works perfectly in IExplorer,
Sure? Maybe you have disabled the display of script errors.
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
if (window.parent.opener.closed)
{
window.parent.close();
};
// -->
</SCRIPT>

This is intended to detect the presence of an open parent window. When
one closes the open parent in IE, the child closes promply.
Where is the event that triggers the above code?
In Netscape, the inner loop is apparently not executed
There is no (`if') loop! `if' is a conditional statement
and you defined a block of statements with `{...}' to be
executed if it evaluates to `true'.
after the window is closed.


Try

function foobar()
{
if (window.parent
&& window.parent.close
&& !window.parent.closed
&& (!window.parent.opener || window.parent.opener.closed))
window.parent.close();
}

and use the `unonload' event handler of the `body' element to call that
function. Note that the event also fires when the user displays another
document in the same window.
PointedEars

Jul 20 '05 #3
"Robert Dickow" wrote on 11/11/2003:
This code works perfectly in IExplorer, but in exactly the same context does not work at all in Netscape 7.x.

<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
The 'language' attribute is depreciated in HTML and shouldn't be used.
You should also realise that "JavaScript" represents v1.0 of the
language. Netscape probably (read: double check with someone else)
interprets this religiously and neither 'opener' nor 'closed' were
introduced until v1.1.
<!--
if (window.parent.opener.closed)
{
window.parent.close();
};
// -->
</SCRIPT>

This is intended to detect the presence of an open parent window.
I don't believe it does:

window
current window
window.parent
parent of the current window
window.parent.opener
window that opened (using window.open) the parent of the current
window
window.parent.opener.closed
true if the window that opened (using window.open) the parent of the
current window is closed

Are you sure that you're checking the correct window? You describe the
parent, not the parent of the parent.
When
one closes the open parent in IE, the child closes promply. In Netscape, the inner loop is apparently not executed after the window is closed. Reversing the logic on the opener test works fine as long as the window is open. But, hey! Isn't ...opener.closed supposed to return something if a window is closed? It seems to simply... fail. The inner loop will not execute with either a negative or positive logic spin

(!window...).

Jul 20 '05 #4
Thanks for the solution! The wonderfully byzantine test clause
solved the problem for Netscape. Turns out that it does ok
with the deprecated LANGUAGE="JavaScript" in this case.

I don't use a trigger event for this at all; it is in the
midst of PHP code and it simply passed to the client
when a certain condition is present. This instantly closes
the client window.

Thomas 'PointedEars' Lahn <Po*********@web.de> wrote in
news:bo*************@ID-107532.news.uni-berlin.de:
Robert Dickow wrote:
This code works perfectly in IExplorer,


Sure? Maybe you have disabled the display of script errors.
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
<!--
if (window.parent.opener.closed)
{
window.parent.close();
};
// -->
</SCRIPT>

This is intended to detect the presence of an open parent window.
When one closes the open parent in IE, the child closes promply.


Where is the event that triggers the above code?
In Netscape, the inner loop is apparently not executed


There is no (`if') loop! `if' is a conditional statement
and you defined a block of statements with `{...}' to be
executed if it evaluates to `true'.
after the window is closed.


Try

function foobar()
{
if (window.parent
&& window.parent.close
&& (!window.parent.opener || window.parent.opener.closed))
window.parent.close();
}

and use the `unonload' event handler of the `body' element to call
that <snip>


--
***********************************
* Bob Dickow (di****@uidaho.edu) *
* Hampton School of Music *
***********************************
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Viviana Vc | last post by:
Hi all, I am using Win2k, VS. NET 7.1 (MS development Environment 2003 7.1.3088) and I noticed that by building the exact same code twice the generated binaries are different (not much, but they...
2
by: Raghu | last post by:
(Sorry for cross post but kinda in a hurry) I have com+ server applicaiton on machine A. The exported application proxy is installed on machine B. Both machines have windows 2003 os. Both...
0
by: San Diego Guy | last post by:
Hi all! I'm working with a SDK provided for some X10 software I have. If I use the code in an ASP page, nothing happens.. no error, just nothing. I haven't had a problem with ASP in the past on...
3
by: Ryan Liu | last post by:
Can someone give a sample to prevent a row from being deleted in a datatable? I tried e.Row.RejectChanges(); in dt_RowDeleting() but seems does not work. I need verify if there other data...
2
by: emaileric | last post by:
Hi all, I am looking for a way to create two different forms, with different look and feel. However, they would both have the same set of controls, and reference the same code behind page. I...
15
by: iwdu15 | last post by:
hi, i have these 2 code snippets: Public Sub ImRec(ByVal IM As IAccIm, ByVal Sender As IAccUser) Dim str As String = IM.GetConvertedText(DECODE) Dim temp As String = str temp =...
0
by: BM | last post by:
Hi, I' using ASP.net 2.0. I have 2 design pages, which are the same, but in 2 languages. Is it possible to use only one code-behind page for both these pages bcoz, the code and logic and...
3
by: Morten Snedker | last post by:
On the load part of 6 differint aspx pages I wish to run the same code. Instead of having the same code on 6 pages it would be kind of nice to have it in one place and include/call it. How...
2
by: rathour | last post by:
<?php session_start(); require_once('db.php'); include('functions.php'); $user = get_username ( $_SESSION ); //if ( $_SESSION ): checkLogin ( '1 2' ); ?>
1
by: ashjas | last post by:
Hello, though this code uses opengl library freeglut,the problem seems to be c++ related..kindly help. and all coding is done in c++ when i try to execute the code,i get this error freeglut ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.