Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnUnload Event problems

Status
Not open for further replies.

lazytrucker

Programmer
Aug 4, 2004
39
0
0
GB
Hi all, I am using a script not unlike this below to open a new page when the client closes the browser:

Code:
<body onLoad="closing=true" onUnload="if (closing) window.open('thanksForVisiting.html');">

The below code has been added to links to ensure the window does not open when navigating.

Code:
<a href="nextpage.htm" onClick="closing=false">Click to go to another page..</a>

The problem I have is that when the user refreshes the browser the same function is carried out, is there any way to determine a difference between a refresh and a close window.

I have looked for an onClose event but I believe it does not exist.

Any help would be greatly appreciated.

Cheers LazyTrucker.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top