Forum Moderators: open

Message Too Old, No Replies

Opera and close window (x)

How to get an alert message in Opera when clicking the close window (x)

         

babloo

8:41 am on May 31, 2004 (gmt 0)

10+ Year Member



I need to get an alert when someone closes the browser with the X button. There is no problem in IE.
Could someone help me out with this.

RonPK

10:19 am on May 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi & welcome to WebmasterWorld, babloo!

What are you currently using, that works in IE?

babloo

10:49 am on May 31, 2004 (gmt 0)

10+ Year Member



In IE this is the code I am using.

in the body tag i am calling the onunload event.
<body onUnload="functionname()">

function functionname()
{
alert('This is an alert');
}

RonPK

3:58 pm on May 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm.... it seems that IE has a different interpretation of the semantics of onunload. Mozilla and Opera both do not consider closing a window an unload event, so I'm inclined to think that IE is getting things wrong ;)

All that doesn't really help you. What you would need is an onclose event - which does not exist...

Maybe it isn't scriptable in order to prevent webdesigners creating pages that cannot be closed.