How to make the onbeforeunload
function be disabled for my own pages and work only for external ones?
How to make disable the code that OG Sean gave here: "Are you sure you want to leave this page?" functions for cancel and OK
<script>
window.onbeforeunload = function(e) {
return 'Are you sure you want to leave this page? You will lose any unsaved data.';
};
</script>
for all my subpages like (domain.com/shop; domain.com/about-us; and domain.com/contact), and enable it only for when you click on the "x" button to close the page? or when you try to type another URL in the address bar?
thanks in advance for the help :)