Problem on setting a cookie on a jquery script -
can please tell me error on code? trying set cookie fancybox popup showing on every refresh. .js included.
<script> $(document).ready(function(){ if(!$.cookie('the_cookie1')){ $.cookie('the_cookie1', 'true', { expires: 3}); $.fancybox( '<h2>hi!</h2><p>lorem ipsum dolor</p>', { 'autodimensions' : false, 'width' : 350, 'height' : 'auto', 'transitionin' : 'none', 'transitionout' : 'none' } ); } }); </script>
i modified code block following , it's functioning expected both in chrome 13 , ff5.
<script> $(document).ready(function () { var cookiename = 'the_cookie1'; var cookie = $.cookie(cookiename); if(cookie === null) { var cookieoptions = { expires: 3, path: '/' /*domain:, secure: false */ }; $.cookie(cookiename, 'true', cookieoptions); $.fancybox( '<h2>hi!</h2><p>lorem ipsum dolor</p>', { 'autodimensions': false, 'width': 350, 'height': 'auto', 'transitionin': 'none', 'transitionout': 'none' } ); } }); </script>
firefox 5
chrome 13
first run, receive box , cookie set. thereafter, no box.
i did notice strangeness chrome cookie not appear in console debugging script in fact revealed cookie set , functioning.
Comments
Post a Comment