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



Recommended Answers

All 5 Replies

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'your popup url', 'thank you', 'window_options');

and insert in the body tag:

<body onunload="thankYou()">

not sure. try it.

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

Sorry i mistyped 'onUnload'
(working example @

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

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

<body onUnload="thankYou()">
<a href="">Y!</a>


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"panel.html", "win", "left=20,top=20,width=500,height=500");

Good luck.

Thanks a lot
It works!!!

Thanks again

Be a part of the DaniWeb community

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