I'm searching for a way to let my users know that they have to log off when they are closing the window. I've already founded this code:
window.onbeforeunload = confirmExit;
function confirmExit()
{
return "It is better if you log out, before you close this page!";
}
$(function ()
{
$("a").click(function()
{
window.onbeforeunload = null;
});
});
This works perfectly when I close my page. just as I want, but it also shows when I reload the page, which shouldn't happen.
Anyone an idea how to solve this, is it even possible?