"Are You Sure You Want To Leave This Page" help

3 replies
Hi

I have the following code to popup the "Are you sure you want to leave this page" message:

<script type="text/javascript">
var popit = true;
window.onbeforeunload = function() {
if(popit == true) {
popit = false;
return "Are you sure you want to leave this page?";
}
}
</script>


The problem is that I see the popup even when I click on internal links and internal pages.

How do I make the popup appear ONLY when a user closes the browser tab?

Thanks.

Trending Topics