browser cookies policy

0
260

//common.js
function checkAgreement(){
cookie_check = readCookie('agree1');
if(cookie_check==undefined)$('.top_msg').show();
if(cookie_check==null && cookie_check!='yes' && header_loaded==true)
{
$('.top_msg').show();
}
}

function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = “; expires=”+date.toGMTString();
}
else var expires = “”;
document.cookie = name+”=”+value+expires+”; path=/”;
}

function readCookie(name) {
name += ‘=’;
for (var ca = document.cookie.split(/;\s*/), i = ca.length – 1; i >= 0; i–)
if (!ca[i].indexOf(name))
return ca[i].replace(name, ”);
}

$(window).load(function(e) {
checkAgreement();
$(‘.agree_btn’).click(function(){
createCookie(“agree1”, “yes”, 365);
});
});

//end

header.php

end of head tag
script
var header_loaded = false;

/script
body area

//css use
.abs-cookies{ width:100%; height:65px; position:fixed; z-index:9999999; top:0; background:#000;}
.cnt-sec{ width:96%; float:left; font-size:13px; padding-top:5px; color:#fff;}
.cnt-sec a{ color:#fff; text-decoration:underline}
.cnt-sec a:hover{ text-decoration:underline}
.close-butt{ width:4%; float:left; text-align:right; margin-top:20px; }