jasonc Posted July 5, 2011 Share Posted July 5, 2011 After my visitors complete a form on my site I wish to have a feedback pop page show when my visitors either closes their browser or navigates to a new site. what is the best method to do this? Link to comment https://forums.phpfreaks.com/topic/241160-popup-page-when-browser-is-closed-or-visitor-navigates-to-another-page/ Share on other sites More sharing options...
AyKay47 Posted July 5, 2011 Share Posted July 5, 2011 you can use the "onunload" javascript event to detect when a user is leaving your site, when the onunload event is triggered, you can trigger a function to create your popup. <head> <script type="text/javascript"> function popUp(url) { popup = window.open(url,"name","height=300,width=200"); if(window.focus) {popup.focus()} return false; } </script> </head> <body onunload="popUp('popup.hmtl')"> Link to comment https://forums.phpfreaks.com/topic/241160-popup-page-when-browser-is-closed-or-visitor-navigates-to-another-page/#findComment-1238734 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.