Hello here
I'm trying to make my fancybox on exit pop up run only once using cookies but it keeps showing every time i refresh or back the page. (I installed cookies plugin and fancybox plugin).
It seems like the cookie isn't getting value, like its null all the time.
This is my code maybe you can help me here. Thanks!
Code:
<script type="text/javascript">
	function PopIt() 
	{
		var COOKIE_NAME = 'cook';
        if($.cookie(COOKIE_NAME) != 'active') 
		{
           $.cookie(COOKIE_NAME, 'active', { expires: 7 });
				$("a#trigger").trigger('click');
				window.onbeforeunload = UnPopIt;
				return "Before you leave:\nPlease take a few seconds to answer 2 questions"; 	
		}
	}	
	function UnPopIt()  { /* nothing to return */ } 
 
	$(document).ready(function() {
		window.onbeforeunload = PopIt;
 
		$("a#trigger").fancybox({
			'hideOnContentClick': false,
			'showCloseButton': true
		});
 
		$("a[id!=trigger]").click(function(){ window.onbeforeunload = UnPopIt; });
	});	
</script>