Redirect on exit from site

I want a better way than the default popup window that comes up when using window.onunload to redirect a user to another page in my site when they attempt to leave.
DelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
I have to tell that that is considered 'bad behavior' on the web.  If you try to 'kidnap' my browser that way, I will close the browser window to leave your site.  You might even end up on a 'malware' list for trying to kidnap users.
0
DelAuthor Commented:
Actually all I want to do is refresh the page with a 10% off offer.  They can still leave after that.
0
Dave BaldwinFixer of ProblemsCommented:
What's wrong with the pop-up then?  Actually, you could make a delayed pop-up that offers them 10% off after 5 or 10 seconds.  That might encourage them to stay before they decided to leave.
0
DelAuthor Commented:
I don't like the default popup window because it looks more like an error message than an informative message.  I wanted something that looked more professional.
0
Dave BaldwinFixer of ProblemsCommented:
You must mean an 'alert' box then.  You don't have to use that, you can put up any kind of popup / new page you want.  You can do a new window or a 'modal' pop-up which is actually a hidden 'div' that you unhide.  You can style the 'div' anyway you want.

Since you used 'cold fusion' for a tag, here's a page about doing it in cold fusion: http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=JavaScriptFcns_28.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.