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

Gecko DOM window onclose event ?

As in topic... has anyone used it ?

I tried to use it but i guess i failed... here is a code:

<html>
<head>
<title></title>
<script type="text/javascript">
function closedWin() {
confirm("close ?");
return false; /* which will not allow to close the window */
}
if(window.addEventListener) {
window.addEventListener("close", closedWin, false);
}

window.onclose = closedWin;
</script>
</head>
<body>

</body>
</html>

Please try and lighten me :-)...

Dec 3 '05 #1
6 62989

is not .onclose, is .onunload :).

Danny
Dec 4 '05 #2
Danny wrote:
is not .onclose, is .onunload :).


It is well known that the `unload' event also fires when the document is
unloaded, i.e. when the location changes. Please get informed before you
try to help here.
PointedEars
Dec 4 '05 #3

Thomas 'PointedEars' Lahn napisal(a):
Danny wrote:
is not .onclose, is .onunload :).
It is well known that the `unload' event also fires when the document is
unloaded, i.e. when the location changes. Please get informed before you
try to help here.


Yes.
Question in topic refers to my older post on How to detect that a user
closes a user agent window - where i suggested the spying popup which
examines window.opener (window.opener.closed) properties.
I ask about onclose, because i wanted to attach that event on Gecko
browsers - and further if such attach will work i could disable spying
popup - all necessery logout via img.src will be done in onclose event
and not in spying popup (so questions from users of Gecko browsers in
style: "Why this popup shows and quickly closes when i click/write/go
to another ulr ?" will probably never rise... only from IE users).

Still waitin for answer on topic question...

PS i tried to open window in JS (popup via window.open) and added to
returned reference the event onclose... closed the opened window but
onclose was not fired :(
[code]
<html>
<head>
<title></title>
<script type="text/javascript">
function testingPopup(evt) {
spyWin = window.open('page2.html','testing',
'width=100,height=100,left=100,top=0,status=0');
spyWin.addEventListener("close", closedWin, false);
spyWin.onclose = closedWin;
}
function closedWin() {
confirm("close ?");
return false;
}
if(window.attachEvent) {
window.attachEvent("onunload", testingPopup);
} else {
if(window.addEventListener) {
window.addEventListener("unload", testingPopup, false);
} else {
window.onunload = testingPopup;
}
}

</script>
</head>
<body>

</body>
</html>



PointedEars


Dec 4 '05 #4
Luke Matuszewski wrote:
Thomas 'PointedEars' Lahn napisal(a):
Danny wrote:
> is not .onclose, is .onunload :).
It is well known that the `unload' event also fires when the document is
unloaded, i.e. when the location changes. Please get informed before you
try to help here.


Yes.
Question in topic refers to my older post


Threads should be continued if the subject virtually is the same.
on How to detect that a user closes a user agent window - where i
suggested the spying popup which examines window.opener
(window.opener.closed) properties. I ask about onclose, because i
wanted to attach that event on Gecko browsers
1. `onclose' is not an event, it is an event handler. The respective event
would be named `close'. However, there is of course no such event in
W3C DOM Level 2 Events (or the Working Group Note on DOM Level 3 Events),
so using addEventListener() is not very likely to work in the first
place.

2. You cannot add previously unsupported event handlers to the implemented
DOM.

3. The Gecko DOM appears to support such an event handler:

<URL:http://developer.mozilla.org/en/docs/DOM:window#Event_Handlers>

Historically, event handlers can be assigned event listeners with
assignment of a Function object reference to the respective property
of the target object. However, it is not described that returning a
false-value will cancel the respective event.
PS i tried to open window in JS (popup via window.open) and added to
returned reference the event onclose... closed the opened window but
onclose was not fired :(


So, ignoring that your examples were not Valid HTML, the event handler
appears not to be supported yet or not longer to be supported in the
Gecko DOM.

Would you please learn to quote?
PointedEars
Dec 4 '05 #5

Thomas 'PointedEars' Lahn napisal(a):
So, ignoring that your examples were not Valid HTML, the event handler
appears not to be supported yet or not longer to be supported in the
Gecko DOM.

Probably thats why it is colored red on
http://developer.mozilla.org/en/docs...Event_Handlers
, but it makes no excuse for them to inform developer that 'red' events
are not supported. This is my assumption, but maybe someone more
knowing will lighten the 'red' events.
Would you please learn to quote?
Looks good here ?
PointedEars


Luke

Dec 4 '05 #6
Luke Matuszewski wrote:
Thomas 'PointedEars' Lahn napisal(a):
So, ignoring that your examples were not Valid HTML, the event handler
appears not to be supported yet or not longer to be supported in the
Gecko DOM.
Probably thats why it is colored red on
http://developer.mozilla.org/en/docs...Event_Handlers


It is possible, but not very likely. That is a Wiki and links colored
different there indicate links to documents that have not been written yet.
, but it makes no excuse for them to inform developer that 'red'
events are not supported. This is my assumption, but maybe someone
more knowing will lighten the 'red' events.


You have yet to understand what a Wiki is. Click the link.
Would you please learn to quote?


Looks good here ?


No. Signatures (literal and technical meaning) are not to be quoted unless
one referrs to them directly. And _all_ quoted material that has no direct
reference should be removed from the followup before it is posted.
PointedEars
Dec 4 '05 #7

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

Similar topics

1
by: abhay | last post by:
Hello all, I want to trap the window.close() event when the user clicks on the close button of the browser using javascript. Can anyone shed light on this problem ? Thanks in advance. ...
6
by: Brian | last post by:
Hi everyone, I'm writing a function (in javascript) that needs to do one thing if the page has not loaded, and another (different) thing if the page has already loaded. I'm looking for a way...
2
by: amywolfie | last post by:
I have a series of 100 select queries (each represents a separate business rule). Each is run after a rule is tested. OnClose of each query, I need to run a report with only the results of...
2
by: harry | last post by:
Hi I am trying to add an event handler to the window so that If the user clicks the close window button, it creates a popup to tell the user it should use the log out button before closing window....
2
by: chris in grimsby | last post by:
MDIChild Window Closing event not raised when MDI Parent is in a class library! Intructions to recreate problem: 1. Create a ClassLibrary project 2. Add an MDIParent form and a form that will...
5
by: jimmy | last post by:
Hi all, I want to capture the event when the browser's close button is clicked in an html page. I tried using the event.ClientX and event.ClientY property in the body unload event, and this...
12
pshm
by: pshm | last post by:
how to handle window closing event in javascript??? window.onunload=function(){ if(window.event.clientY < 0 && window.event.clientY < -80){ alert('window close event triggered'); } }...
10
by: kpfunf | last post by:
I have an OnClose function that opens a switchboard (SwitchOpen). This function is placed in numerous objects' (reports and forms) OnClose event, and works great. However, a very annoying...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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...
0
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.