473,378 Members | 1,393 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,378 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 62962

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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.