xxxxxxxxxx
window.onbeforeunload = function() {
return "Dude, are you sure you want to leave? Think of the kittens!";
}
xxxxxxxxxx
It is not advised, but if you want to completely prevent the user from
refreshing the page you can use:
setInterval(function(){
window.location.reload();
window.stop();
},100)