bellefaith
03-25-2006, 06:58 PM
I want to have my website display a popup window when a visitor leaves my website.
I have seen numerous examples that use onbeforeunload to popup a page when the visitor leaves the page. However, onbeforeunload still creates a popup if the visitor hits the back button or the refresh button in their browser.
Is there an alternative to onbeforeunload so that popups only pop up when a visitor leaves my domain completely?
For example, if a visitor is on my website and reloads the page or clicks the back button to go back to another page of my website, I don't want him to see the popup. But if a visitor on my website goes to google.com, I would like the popup to appear.
Thank you.
I have seen numerous examples that use onbeforeunload to popup a page when the visitor leaves the page. However, onbeforeunload still creates a popup if the visitor hits the back button or the refresh button in their browser.
Is there an alternative to onbeforeunload so that popups only pop up when a visitor leaves my domain completely?
For example, if a visitor is on my website and reloads the page or clicks the back button to go back to another page of my website, I don't want him to see the popup. But if a visitor on my website goes to google.com, I would like the popup to appear.
Thank you.