Jump to content

alert once browser window closed


robert_gsfame

Recommended Posts

<html>
02.
<head>
03.
<script type="text/JavaScript">
04.
function ExitPage()
05.
{
06.
alert ('Before You Leave:\n\nPlease Check our new tutorials on <a class="linkifierplus" href="http://www.mistonline.in.\n\nMore">http://www.mistonline.in.\n\nMore</a> than 250 tutorials.\n\nPlease submit your own tutorials for free\n\nA complete reference for webmasters!!!!!.');
07.
getit()
08.
}
09.
function getit() {
10.
askit = confirm("Leaving so soon? Why not stay a little longer!");
11.
if (askit == true)
12.
alert('Thanks');
13.
else
14.
if (askit == false)
15.
alert("Visit again soon!");
16.
}
17.
</script>
18.
</head>
19.
<body onbeforeunload="ExitPage();">

 

Found this code on http://www.tutorialized.com/view/tutorial/Alert-a-message-before-leaving-a-web-page-using-javascript/65638.

 

Denno

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.