Onigara
06-11-2008, 02:58 PM
Hello,
I am trying to create code for an ecommerce site that will prompt the user to take a survey if they are leaving the site or closing the window, but not if they are navigating within the page.
I have seen code using the onbeforeunload event, but this seems to trigger in all situations where the page is changed, even if they are going to another page in the same site - which is not desired.
Is there a way to have the popup appear only if the user is closing the window or leaving the site?
I am trying to create code for an ecommerce site that will prompt the user to take a survey if they are leaving the site or closing the window, but not if they are navigating within the page.
I have seen code using the onbeforeunload event, but this seems to trigger in all situations where the page is changed, even if they are going to another page in the same site - which is not desired.
Is there a way to have the popup appear only if the user is closing the window or leaving the site?