I want to show a popup winodw before I closing my browser. Here is my code.I used following plugin
http://kbeezie.com/cross-browser-exit-pop/
here is the demonstration http://kbeezie.com/exitpop.html
<script type="text/javascript">
function PopIt() {
$("a#trigger").trigger('click');
window.onbeforeunload = UnPopIt;
return "Would you like to join our mailing list for other offers?";
}
function UnPopIt() { /* nothing to return */ }
$(document).ready(function() {
window.onbeforeunload = PopIt;
$("a#trigger").fancybox({
'hideOnContentClick': false,
'showCloseButton': false
});
$("a[id!=trigger]").click(function(){ window.onbeforeunload = UnPopIt; });
});
but this code shows a "Would you like to join our mailing list for other offers?" question before showing the popup window. I want to remove that popup question and only show that popup window there.