I am currently coding a custom cookie law solution for several websites. I am trying to make the solution/plugin as much of an "all in one solution" as possible with the code being included as the first bit of script. currently I have almost done everything and it all looks very pretty, I want to give the user the ability to "accept" or "deny" with deny not just redirecting them away but still allowing them to use the website.
So far I have a cookie being set correctly for accept and deny which either sets a true or false value in a cookie based on there choice accept or deny.
I would like to use the code I have found for redefining the cookie setter and getter, in a if statement to prevent cookies from being set if the user has either not given a permission or not selected an answer yet.
document.__defineGetter__("cookie", function() { return '';} );
document.__defineSetter__("cookie", function() {} );
So far I have this code to check if the user has allowed cookies,
if(checkCookie != true){
// Run code to redefine cookie setter getter to prevent cookies from being set
}else{
// Don't do anything and the cookies should be run as usual.
};
Could someone enlighten me or point me in the right direction on how to use cookie setter and getter to do as I have explained?