+ 1
How do I alert the user in javascript when exiting site?
Javascript code to create an alert when user tries to exit website.
6 odpowiedzi
+ 2
See this function: window.onbeforeunload = function () {}
+ 2
Kk.
+ 1
Thanks..It worked
+ 1
<script type="text/javascript">
window.onbeforeunload = confirmExit;
function confirmExit()
{
return "Do you want to leave this page without saving?";
}
</script>
0
Please, show me how it worked... 😉
0
Thx! maybe return will be in ()?