473,698 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="JavaS cript">
<!--
if (window.parent. opener.closed)
{
window.parent.c lose();
};
// -->
</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.close d 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 4544
Robert Dickow wrote:
This code works perfectly in IExplorer,
Sure? Maybe you have disabled the display of script errors.
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaS cript">
<!--
if (window.parent. opener.closed)
{
window.parent.c lose();
};
// -->
</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.c lose
&& (!window.parent .opener || window.parent.o pener.closed))
window.parent.c lose();
}

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="JavaS cript">
<!--
if (window.parent. opener.closed)
{
window.parent.c lose();
};
// -->
</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.c lose
&& !window.parent. closed
&& (!window.parent .opener || window.parent.o pener.closed))
window.parent.c lose();
}

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="JavaS cript">
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.c lose();
};
// -->
</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.o pener
window that opened (using window.open) the parent of the current
window
window.parent.o pener.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.close d 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="JavaS cript" 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*********@we b.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="JavaS cript">
<!--
if (window.parent. opener.closed)
{
window.parent.c lose();
};
// -->
</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.c lose
&& (!window.parent .opener || window.parent.o pener.closed))
window.parent.c lose();
}

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
399
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 are). To be sure I tried a simple console application like void main(){} and 2 times rebuilding the project gets 2 different binaries. Has anybody any clue why this happens? Could I somehow change a setting or something to remove those diff (I
2
1543
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 machines are configured to be application servers. I created on machine B: 1) A vbs file 2) VB.NET assembly Both create the same component using CreateObject on machine B as shown
0
1237
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 this computer and other ASP pages render fine. If I use the (almost) identical code in a stand alone VBS it works fine. Both the ASP and VBS are running on the same computer and it's an XP SP2 with IIS installed.
3
2295
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 using data in this row before actually remove it from datagrid. I can certainly control with Delete button. But if I want to allow the user to use Del key on the keyboard, I lost this kind control.
2
1652
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 would also like to be able to switch between which form is displayed to the user through the C# code. Is anything like this possible? I am using VS2005. Thanks in advance for any ideas submitted!
15
1570
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 = temp.Remove(temp.IndexOf("<body>"), 6) temp = temp.Remove(temp.IndexOf("</body>"), 7)
0
1112
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 everthing else is the same and I've taken care about the messages and other small differences in the code. I've given the same Id for the web controls on both pages. On the @page directive, I'm using the same file and class in the 'codefile' and...
3
923
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 should I do this? Regards /Snedker
2
1501
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
2009
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 ERROR: Function <glutBitmapCharacter> called without first calling 'glutInit'. the thing of concern is that the same code runs fine on one system
0
9161
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7732
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6522
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.