user3336435
user3336435

Reputation: 1

Stopping a cookie from being deleted when the browser is closed

I have addded a plugin to my cms "quick.cms" - simple notice about use cookies. This script throw an information at every entrance, i want to script check cookie and display information only first visit. Check: duka-polska.pl, after closing browser the information display again.

 function simpleNotice( sNotice ){
  jQuery(document).ready(function(){
    var bCookiesNoticeClosed = throwCookie( 'bCookiesNoticeClosed' );
    if( !bCookiesNoticeClosed && sNotice != '' ){
      $( 'body' ).prepend( '<div id="noticeAboutCookies">'+sNotice+'<a href="#" class="close">[x]</a></div>' );
      jQuery("#noticeAboutCookies").delay(1000).slideToggle("slow");
      jQuery("#noticeAboutCookies .close").click(function(){
        jQuery("#noticeAboutCookies").delay(500).slideUp("slow")
        createCookie( 'bCookiesNoticeClosed', true );
        return false;
      });
    }
  });
}

Upvotes: 0

Views: 1324

Answers (1)

Quentin
Quentin

Reputation: 943510

You haven't provided the code for createCookie, but there is no sign of a time stamp there. If you set a cookie without an expiry time, then it expires when the browser is closed.

Set an expiry time on the cookie.

Upvotes: 1

Related Questions