Im IE funktioniert das:
window.onbeforeunload = function(){
if(bPageSaved == false){
event.returnValue = "Your last changes have not been saved!";
}
}
http://msdn.microsoft.com/workshop/Author/dhtml/reference/events/onbeforeunload.asp
Gruß
Martin