469,332 Members | 6,649 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,332 developers. It's quick & easy.

Opera - .closed not accessible if window is closed?

See: http://www.mattkruse.com/temp/window_closed.html

It looks like the .closed property of a window is inaccessible if the
window is actually closed. Other browsers have no problem detecting
that the window has been closed. Opera 7.11 and 7.20b7 both throw
errors when trying to check the .closed property.

Is this a bug in Opera, or do I have to (once again) take special
action to make normal javascript work with Opera?

Matt Kruse
(who still finds very few redeeming qualities in Opera...)
Jul 20 '05 #1
5 4201
On 7 Sep 2003 15:18:28 -0700, ma**@mattkruse.com (Matt Kruse) wrote:
See: http://www.mattkruse.com/temp/window_closed.html

It looks like the .closed property of a window is inaccessible if the
window is actually closed. Other browsers have no problem detecting
that the window has been closed. Opera 7.11 and 7.20b7 both throw
errors when trying to check the .closed property.

Is this a bug in Opera, or do I have to (once again) take special
action to make normal javascript work with Opera?

Matt Kruse
(who still finds very few redeeming qualities in Opera...)


From what I understand about the design philosophy of Opera, that is
so you won't pop up another annoying pop up in someones face. Cruising
the Opera forums, newsgroups, KB and bug reports will tell you for
sure. From a users point of view, Opera is pretty good, and definitely
a good alternative to the crap microsoft puts out.

Andy
-
"There would be a lot more civility in this world if people
didn't take that as an invitation to walk all over you"
- (Calvin and Hobbes)
Jul 20 '05 #2
"andy johnson" <an************@chicagonet.net> wrote:
From what I understand about the design philosophy of Opera, that is
so you won't pop up another annoying pop up in someones face. Cruising
the Opera forums, newsgroups, KB and bug reports will tell you for
sure.
unfortunately, I can't find any mention of this anywhere. I'm still
looking...
I think the correct behavior should be, if my script created the window,
then my script should be able to check if it's closed, regardless of what is
being displayed in it at the time.

Mozilla used to have this same bug, and they fixed it to let .closed be
visible to any code, regardless of security.
From a users point of view, Opera is pretty good, and definitely
a good alternative to the crap microsoft puts out.


It's all a metter of personal preferences. I've disliked every version of
Opera I've tried, and I've liked IE since version 5. I've been testing and
using browsers since mosaic came out, and I think IE6 is the best of any one
I've seen :)

Matt

Jul 20 '05 #3
On Sun, 07 Sep 2003 23:36:03 +0000, Matt Kruse wrote:
"andy johnson" <an************@chicagonet.net> wrote:
From what I understand about the design philosophy of Opera, that is so
you won't pop up another annoying pop up in someones face. Cruising the
Opera forums, newsgroups, KB and bug reports will tell you for sure.


unfortunately, I can't find any mention of this anywhere. I'm still
looking...
I think the correct behavior should be, if my script created the window,
then my script should be able to check if it's closed, regardless of
what is being displayed in it at the time.

Mozilla used to have this same bug, and they fixed it to let .closed be
visible to any code, regardless of security.
From a users point of view, Opera is pretty good, and definitely a good
alternative to the crap microsoft puts out.


It's all a metter of personal preferences. I've disliked every version
of Opera I've tried, and I've liked IE since version 5. I've been
testing and using browsers since mosaic came out, and I think IE6 is the
best of any one I've seen :)

Matt


Hi Matt

I am no expert here, just learning the language but remember an exercise I
did in my book on this subject. Here is the full code of the exercise, it
creates a window then takes care of all browsers and how to check if the
window has been closed by either the code or the user, if the window has
been closed it will open the same window then close it again, then there
are no errors. Take a look it might help, you might be able to adapt some
of it to your advantage.

Hope it helps
DaveG
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> <HTML>
<HEAD>
<TITLE>window.closed Property</TITLE> <SCRIPT LANGUAGE="JavaScript">
// initialise global var for new window object // so it can be accessed
by all funtions on the page. var newWind

// set flag to help out with special handling for window closing var
isIE3 = (navigator.appVersion.indexOf("MSIE 3") != -1) ? true : false

// make new window and put some stuff in it. function newWindow() {
var output = ""
newWind = window.open("", "subwindow", "HEIGHT=200, WIDTH=200")

// taking care of navigator 2
if (newWind.opener == null) {
newWind.openern = window
}
}
output += "<HTML><BODY><H1>A sub-window</H1>" output += "<FORM><INPUT
TYPE='button' VALUE='Close Main Window'
onClick='window.opener.close()'></FORM></BODY></HTML>"
newWind.document.write(output)
newWind.document.close()
}
// close subwindow, including ugly workaround for IE3 function
closeWindow() {
if (isIE3) {
// if window is already open, nothing appears to happen // but if not,
the subwndow flashes momentarily (ahhh) newWind = window.open("",
"subwindow", "HEIGHT=200, WIDTH=200")
}
if (newWind && !newWind.closed) {
newWind.close()
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM>
<INPUT TYPE="button" VALUE="Open Window" onClick="newWindow()"><BR>
<INPUT TYPE="button" VALUE="Close it if still open"
onClick="closeWindow()">
</FORM>
</BODY>
</HTML>
Jul 20 '05 #4
"Dave Griffiths" <da**@daveg.co.uk> wrote:
I am no expert here, just learning the language but remember an exercise I
did in my book on this subject. Here is the full code of the exercise
...
if (newWind && !newWind.closed) {
newWind.close()
}


This is basically exactly what I'm doing, and what fails in Opera7, when the
domain of the popped up window is not the same as the opener.
:(

Matt Kruse
Jul 20 '05 #5
"Matt Kruse" <ne********@mattkruse.com> wrote in message
news:6I97b.394629$YN5.261425@sccrnsc01...
<snip>
This is basically exactly what I'm doing, and what fails in Opera7, whenthe domain of the popped up window is not the same as the opener.


In theory, one horrible hackish quick fix would be to have the pop-up
load a frameset page form your domain and then have that frameset load
the page from the other domain. That should leave the new window object
accessible to your scripts.

Given the choice I would go for loosing the pop-up in preference.

Richard.
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Shaun Fleming | last post: by
44 posts views Thread by Mariusz Jedrzejewski | last post: by
32 posts views Thread by Eli | last post: by
7 posts views Thread by E Michael Brandt | last post: by
21 posts views Thread by alistair_henderson | last post: by
6 posts views Thread by toffee | last post: by
2 posts views Thread by koruyucu | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.