About This File
This is a modification of the Cookie Consent javascript from https://silktide.com/tools/cookie-consent/
The original was trying to be too clever for my tastes with multiple font sizes and sliders for different screen sizes. It didn't look great on my desktop, tablet, phone. It would I've stripped it down to the bare minimum to reduce distraction. It just features a single line in body text.
The original version used an Amazon S3 address for the javascript and CSS which was OK but the Cache-Control / Expires headers are not present which wasn't great for PageSpeed/YSlow reports and caching. With this version you have to self-host the files. Of course if you use a CDN you can upload them there too.
Whether it complies with the EU cookie law as implemented in your country is for you to determine - this implementation is fine for the UK and common to a number of notable websites such as http://www.theregister.co.uk (it's what I modelled the banner and CSS on).
To use:
- Upload the js and css files to your host somewhere.
- Add this code to your pages just before the </head> tag. Modify the text as required and adjust the url for the css.
Example:
<!-- Begin Cookie Consent --> <script type="text/javascript"> window.cookieconsent_options = {"message":"This website uses cookies","dismiss":"Close","learnMore":"Find out more","link":"https://www.yoursite.com/site/cookie-policy/","theme":"//www.yoursite.com/js/cookieconsent/cookieconsent-dark.css"}; </script> <script type="text/javascript" src="//www.yoursite.com/js/cookieconsent/cookieconsent.min.js"></script> <!-- End Cookie Consent -->
See the forum url for more details/discussion..