I'm trying to confirm before user leaves the page and I used this solution
<script>
window.onbeforeunload = function(){
return 'Are you sure you want to leave?';
};
</script>
but this only works when you interact with something on the page like maybe a clicking or typing, it doesn't work when you directly close the page
and I made a logging only popup page i.e. there is nothing on the page to interact with, so how do I still get it to confirm before leaving?