This really simple script to adhere to the EU Cookie Law is literally a copy/paste job which informs the user about cookies and asks them what they would like to do. If they accept cookies then it removes the notification for 365 days. If they decline the use of cookies it then continuously deletes any cookies set.
The EU Cookie Law
“The Cookie Law is a piece of privacy legislation that requires websites to get consent from visitors to store or retrieve any information on a computer, smartphone or tablet.”
Source: The Cookie Law
In a world where our time is precious we don’t need options – we need a Yes or No. That’s exactly what the script does. It either allows all cookies or disables them. Simple.
Installation
Just copy/paste the code below into the <head></head> section of your page – and that’s it!
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> <script src="//cdn.ss88.co.uk/cookie/accept-cookies.js"></script>
Note: if you need it to work on SSL connections please download your own copy and install.
Demo
It should have already popped up on this page.
Customisation
It comes with a free customisation tools as defined below. Just edit the call to include an array of options.
$(this).acceptCookies({ position: 'bottom', textcolour: '#FFF', fontfamily: 'Arial, sans-serif' });
position:
bottom or top
textcolour:
HEX value of a colour
fontfamily:
CSS font-family option
You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>