472,794 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,794 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 7695
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.