<body onLoad="closing=true" onUnload="if (closing) window.open('thanksForVisiting.html','newwin');"> <a href="nextpage.htm" onClick="closing=false">Click to go to another page..</a>