Forum Moderators: open

Message Too Old, No Replies

onUnload

Need a little help...

         

textex

11:58 am on Apr 24, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to ad an onUnload to my order 'thank you' pages so that everytime the user leaves the thank you page, they are presented with a 'refer a friend' offer. However, I have some additional offers on my thank you page with exterior links that I do not want to be affected by the onUnload when they are clicked.

Thanks!

httpwebwitch

5:54 pm on Apr 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



sounds like you need to apply an "onclick" to all those external links, to set a flag which disables the onunload behaviour. AFAIK the onclick will fire before the onunload does... it's worthy of some experimentation.

<a href="whatever" onclick="window.dontbotherme=true;"> external link </a>

you might also try using onmousedown instead of onclick.

<body onunload="if(!window.dontbotherme){showthankyou();return false}" />

be careful that your onunload doesn't actually interfere with people leaving your page; and I'd also be wary of how popup blockers intercept this.

please report back here to let us know how it goes, K?