Hey guys i remember coming to the site a while ago and seeing a tutorial on how you did the prompt when you try to leave the page. I'd really love some insight into this. i had a function that kind of works, very simple:

body.onunload = "javascript: try_leaving();"

function try_leaving(){
var leave = prompt("are you sure you want to leave");
if(!leave) location=self.location;
}

the problem is it's an ajax app and it refreshes the whole page, restarting the app. please help.