I have a message on a website that appears once the page loads, and at the moment, I have a method of seeing if its set to true and if it is it doesnt appear again, but i noticed if I close the browser and go back to the page it loads again, when ideally unless they clear out their cookies, the message should never appeara again.
$(document).ready(function() {
if ($.cookie('noShowWelcome')) $('#cristalcheck_app').hide();
else {
$.cookie('noShowWelcome', true);
$('#cristalcheck_app').delay(1000).animate({
bottom: "0px"
}, 600, function() {
$('#cristalcheck_app').delay(9500).animate({
bottom: "-100px" });
});
}
});
Then I copied a load of javascript and included it, and this section below seems to deal with the expiry, so can someone help me so that the cookie is never to appear again, unless that cookie doesnt actually exist in their history, which is obviously fine.
if (arguments.length > 1 && !$.isFunction(value)) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
}
return (document.cookie = [
encode(key), '=', stringifyCookieValue(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}