faqts : Computers : Programming : Languages : JavaScript : Event handling

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 10 people (30%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

onUnload event handler doesn't work in Opera7.11, alert() etc. do not trigger! Plz Help, thx

Oct 8th, 2003 18:27
Fred Jounters, Jean-Bernard Valentaten,


> You might just want to activate JavaScript in your browsers 
properties.
It is activated!
Here's the code, in case u want to try yourself:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
<HTML> 
<HEAD> 
<TITLE>that test</TITLE> 
<SCRIPT LANGUAGE="JavaScript"> 
<!--//
window.onunload = abort;
function abort() {
 alert("triggered!");
}
//--> 
</SCRIPT> 
</HEAD> 
<BODY>
Something here
</BODY> 
</HTML>
Works fine in IE...
Funnily enough, when You load the html the first time, nothing happens 
when leaving the page (closing window..) but when reloading it, the 
event gets triggered, or when adding additional info to the uri (file.
html?test).. So I guess, it's just that Opera doesn't trigger onUnload 
when window gets closed, but only when it is "left"... Guess it has to 
do with execution time before the leftovers are burnt to garbage?
Any other ideas?