View Full Version : cookies with jquery

09-05-2010, 12:53 PM
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!

<script type="text/javascript">
function PopIt()
var COOKIE_NAME = 'cook';
if($.cookie(COOKIE_NAME) != 'active')
$.cookie(COOKIE_NAME, 'active', { expires: 7 });
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;

'hideOnContentClick': false,
'showCloseButton': true

$("a[id!=trigger]").click(function(){ window.onbeforeunload = UnPopIt; });