Link to home
Start Free TrialLog in
Avatar of CVNetworks
CVNetworks

asked on

Leaving Website Alert Box

On our corporate site we need to have links that are external to our company come up with an Alert Box stating they are leaving the site.  If they choose continue it will allow them to go to that link but if they cancel it will go back to the exisitng web page.  I am unsure of how to do this and want to see if anyone can help create a script that can accomplish this task.  
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
javascript has onunload event for body, but using this you cannot return to the web-page since that event is called after the page is unloaded.

javascript also has onbeforeunload event, which is called before unloading happens, but it works only on IE.

So, i don't think there is any way to achieve your requirement
ohh...k

I was thinking if you are asking to show that prompt when user clicks on browser's close button... My bad
Take a look at this script, I think it will do what you want.
Avatar of CVNetworks
CVNetworks

ASKER

This is exactly what I was looking for.