473,386 Members | 1,832 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,386 software developers and data experts.

Closing window not opened by the script - Netscape 7.1


Dear Folks,

The application I am working on uses Frames (TopFrame, SideFrame(Left)
and the MainFrame). On the occurance of a certain event, I am closing
the window from one of the frames. This is the script I use.

function CloseWin ()
{
window.opener = window;
window.close();
}

Works perfectly well with IE. But not with Netscape. The Javascript
console says 'Script may not close windows that were not opened by the
script'. Is there any workaround to this?

Would indeed appreciate your help on this.

Arun
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #1
8 7735
Arun Seetharam wrote:
The application I am working on uses Frames (TopFrame,
SideFrame(Left) and the MainFrame). On the occurance of
a certain event, I am closing the window from one of
the frames. This is the script I use.

function CloseWin ()
{ <snip> window.close();
}

Works perfectly well with IE.
It exploits what is generally considered a bug in IE.
But not with Netscape. The Javascript console says
'Script may not close windows that were not opened by
the script'. Is there any workaround to this?

<snip>

No. 'Script may not close windows that were not opened by the script'

Users wanting to close their browser have numerous options available to
them and do not need another.

Richard.
Jul 23 '05 #2
Arun Seetharam wrote:
Dear Folks,

The application I am working on uses Frames (TopFrame, SideFrame(Left)
and the MainFrame). On the occurance of a certain event, I am closing
the window from one of the frames. This is the script I use.

function CloseWin ()
{
window.opener = window;
window.close();
}

Works perfectly well with IE. But not with Netscape. The Javascript
console says 'Script may not close windows that were not opened by the
script'. Is there any workaround to this?


No, there is no workaround. And if the Microsoft folks were doing their
job, the code you posted wouldn't work in IE either (and may hopefully
stop working at some point in the future).

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
Grant Wagner wrote:
Arun Seetharam wrote:


<--snip-->
Works perfectly well with IE. But not with Netscape. The Javascript
console says 'Script may not close windows that were not opened by the
script'. Is there any workaround to this?

No, there is no workaround. And if the Microsoft folks were doing their
job,


And the people at OmniWeb, Opera and all the other non-Mozilla based
browsers where it works were doing their job.............

Jul 23 '05 #4
Oh Enlightened ones, my sincere thanks to you all of you. You have
quelled my ignorance.

Be Blessed
Arun

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #5


Oh Enlightened ones, my sincere thanks to you all of you. You have
quelled my ignorance.

Be Blessed
Arun

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #6
Randy Webb wrote:
Grant Wagner wrote:
Arun Seetharam wrote:


<--snip-->
Works perfectly well with IE. But not with Netscape. The Javascript
console says 'Script may not close windows that were not opened by the
script'. Is there any workaround to this?

No, there is no workaround. And if the Microsoft folks were doing their
job,


And the people at OmniWeb, Opera and all the other non-Mozilla based
browsers where it works were doing their job.............


I'm not sure what your point is. If it's that the authors of the browsers
mentioned above have a bug in their software by allowing this behaviour, I
agree.

Presumably you are mentioning the other browsers to demonstrate that it is a
"feature" and not a "bug". However, if it were a "feature", then:

window.close();

would just *work* without a prompt. You would not have to resort to:

window.opener = window; window.close();

to get it to do what you want. The fact that you have to "fool" the browser
into having a valid value assigned to the "window.opener" property
demonstrates that it is a bug.

After all, what is the point of including code that stops you from executing
window.close(); if there is a way to avoid the warning? Why not introduce a
proprietary feature like window.close(true); to suppress the warning? Such
functionality would break no existing code and allow Microsoft to make it's
"feature" available in a way that doesn't involve what is obviously a hack.

When I reported the problem to Microsoft as a security vulnerability, I
received a very polite reply that basically Microsoft acknowledges that it is
a bug, but does not regard it as a "security" problem, because the user can
simply re-open the closed window. I guess they can't be bothered spending
some of that $60 billion cash surplus on fixing this.

Anyway, I look forward to the day some security patch or other breaks the
above code, and we are flooded with "... this used to work, what can I do
now?" type posts. I won't even try to avoid saying "I told you so", I'll just
laugh. Of course, most of these people shouldn't be trying to open new
windows in the first place given the current state of new window hatred, but
that's an argument for another time.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #7
Grant Wagner wrote:
Randy Webb wrote:

Grant Wagner wrote:
Arun Seetharam wrote:


<--snip-->
Works perfectly well with IE. But not with Netscape. The Javascript
console says 'Script may not close windows that were not opened by the
script'. Is there any workaround to this?
No, there is no workaround. And if the Microsoft folks were doing their
job,


And the people at OmniWeb, Opera and all the other non-Mozilla based
browsers where it works were doing their job.............

I'm not sure what your point is. If it's that the authors of the browsers
mentioned above have a bug in their software by allowing this behaviour, I
agree.


My only point was that its not just Internet Explorer that has the bug.
The implication of your statement (to me anyway) "And if the MS
folks....." was that it implied that it was an MS-only bug when its not.
Mozilla based browsers seem to be the only ones that get it right.

Jul 23 '05 #8
Randy Webb wrote:
Grant Wagner wrote:
No, there is no workaround. And if the Microsoft folks were doing their
job,

And the people at OmniWeb, Opera and all the other non-Mozilla based
browsers where it works were doing their job.............

I'm not sure what your point is. If it's that the authors of the browsers
mentioned above have a bug in their software by allowing this behaviour, I
agree.


My only point was that its not just Internet Explorer that has the bug.
The implication of your statement (to me anyway) "And if the MS
folks....." was that it implied that it was an MS-only bug when its not.
Mozilla based browsers seem to be the only ones that get it right.


Oh.

Agreed.

I threw together a quick test when I got your original post:

<a href="#" onclick="window.close();return false;">Close</a>
<form>
<input type="submit">
</form>

I loaded it into Opera 7.53, I clicked submit a few times (to create history),
then clicked "Close" and was shocked to discover the window just closed. Either
what I did didn't create any history, or it worked because the file was loaded
locally from the HD. I didn't bother to test any further, it just shocked me
that Opera would allow something like that.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #9

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

Similar topics

4
by: John H. | last post by:
Hello I have some trouble in closing a window, Here is the problem: I develop a asp.net website use client side valiation <asp:CustomValidator id="CustomValidator1"...
2
by: Jawahar Rajan | last post by:
All, I have a printer friendly page that is opened when a user clicks a link on my page to get the printer friendly version, How ever when they close out the printer friendly version and return to...
14
by: Nigel Mercier ® | last post by:
I'm just starting to learn JavaScript, so far I like it! I want to add some JS to my Ebay listings, to manually open a pop-up window. It works OK, but the JS gets rejected by Ebay. If I can't...
3
by: Edwin Boersma | last post by:
Hi, I've just installed Netscape 7.1 for Linux and the following script refuses to open a window when I call this function: function OpenLinkWindow() { ...
1
by: Obscurr | last post by:
hi, I'm trying to close a browser window, from a window that has been opened using the window.open method. I've tried amongst others: opener.close() <windowname>.close() top.close()...
4
by: ken quirici | last post by:
Hi, I'm a beginner working thru the javascript tutorial at htmlgoodies.com. The following works on netscape 7.1 and IE: *************************************************** <!DOCTYPE HTML...
3
by: Asit | last post by:
<META HTTP-EQUIV="expires" content="0"> <META HTTP-EQUIV="pragma" content="no-cache"> <html> <head> <title>Fidelity NetBenefits</title> </head> <body BGCOLOR="#ffffff"> <script...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
16
by: CreativeMind | last post by:
hi, i have a page calendar.aspx which returns selected date i.e window.returnValue=selectedDate; window.close(); it works fine with IE but not for Firefox. i tried...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.