By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,625 Members | 1,720 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,625 IT Pros & Developers. It's quick & easy.

IE onunload no longer works when window closing!!?

P: n/a
Hi, well it appears (and please please correct me if I am wrong) that
since some IE patch (I am using 6.0.2800.1160 SP2) the browser no
longer calls the onunload handler when running outside of localhost
(but why??).
eg.
<html>
<script>
function mesg(){
alert("hello");
}
</script>
<body onunload="mesg()">
hello
</body>
</html>

if you put that on localhost, open it in IE and then close the browser
you should get the alert. However if you move it to some non localhost
server and repeat, there will be no alert.

This definately worked before (before some patch came along) - one
solution is to use onbeforeunload instead, but it is of course IE
only(?) :(

Anybody know why, or any different?

Thanks,
Jim

Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
jd*******@shaw.ca wrote:
if you put that on localhost, open it in IE and then close the browser
you should get the alert. However if you move it to some non
localhost server and repeat, there will be no alert.


Cannot confirm that here using a current MSIE 6.0.2900.2180 (SP2) and
http://www.innoline-systemtechnik.de/dhgm/onunload.html

The only change relating to onunload I find documented in MSDN is
that Window.open() is ignored onunload in MSIE 6 SP2.

ciao, dhgm
Jul 23 '05 #2

P: n/a
Thanks for replying - your page doesn't work for me either, I'm sure
it's not a setting local to me as it's been reported by a customer (on
several machines) aswell....

Maybe it was broken in v.2800. and fixed in v.2900 ?

Jim

Jul 23 '05 #3

P: n/a
jd*******@shaw.ca wrote:
Thanks for replying - your page doesn't work for me either, I'm sure
it's not a setting local to me as it's been reported by a customer (on
several machines) aswell....

Maybe it was broken in v.2800. and fixed in v.2900 ?


I tried Dietmar's link with IE 6.0.2800 on Win XP SP 1 and it
works fine, so that ain't it.

--
Rob
Jul 23 '05 #4

P: n/a
Thanks Rob, would other people please try Dietmar's link

http://www.innoline-systemtech*nik.d.../onunload.html

and post a message if you don't see an alert box when closing the
browser window.

I'm certain this is nothing specific to me, and I am sure many people
would need to know of the same issue.

Thanks,
Jim

Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.