Is it possible to have a small page load (saying thanks for visiting etc.) when the user closes my website?

Thanks

Martin

Pop-ups are generally hated by everyone, even if it is just to say thank you.

Just a warning.

Try create function in javascript like below:

<script language=javascript>
 function thankYou(){
  var win=window.open('your popup url', 'thank you', 'window_options');
 }
</script>

and insert in the body tag:

<body onunload="thankYou()">

not sure. try it.

I tried it but it didn't work.
Thanks anyway.
Martin

Sorry i mistyped 'onUnload'
(working example @ http://www.geocities.com/cppforlife/projects/html/thankyou.html)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
 <title>Thank You!!!</title>
 <script language=javascript>
  function thankYou(){
   var win=window.open("panel.html", "win");
  }
 </script>
</head>

<body onUnload="thankYou()">
<a href="http://www.yahoo.com">Y!</a>


</body>
</html>

code above checked in IE and worked properly..
Also replace 'panel.html' with url of you thenk you page.

If you want to change size of the window and other attributes add third argument to open function like below

var win=window.open("panel.html", "win", "left=20,top=20,width=500,height=500");

Good luck.

Thanks a lot
It works!!!

Thanks again
Martin

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.