View Full Version : Javascript alert when leave a site ???

06-11-2010, 04:12 AM
I need to a small task in Javascripts and I would like to know whether this can be done.
If someone knows a way that can be done or provide me some code, I would be more greatful.

This is the task I need to do :-

I have a small shoppig cart. I want when a customer visit the site, if that is his first time
on the website and before he quit the browser or go to another URL of another domain or press back
and go to another page, an alert should pop up.

I have did this using cookies and Javascripts and it is working properly as I wanted.
But this alert pops up even when I go inside of my own web. I want this alert only
to popup when they leave from my web or go to anyother and it should not popup when
I click on my links or go in to my web.

I hope, I explained what I want and it is clear. Please if someone knows a solution for this.
Please send me your ideas or if you have some codes that can be helpfull to me,
please send me.

Thank you.