cookiealert.js
A tiny JavaScript library for displaying implicit consent cookie messages. It differs from other solutions in that it aims to be accessible.
We found that too many of the solutions already out there relied on over libraries, or provided kitchen-sink functionality way beyond the needs of most site owners. We wanted something small, simple and elegant.
It — ironically — sets a cookie to store visitor consent and is designed to work without the need for any third-party JavaScript libraries.
Features
- Minimal configuration: create your message markup in HTML, then make one call to the
cookiealert()function - Degrades elegantly: no JavaScript, no problem. If users don't have Javascript enabled/available, then the message still gets shown.
- Standalone: no need for jQuery or other JS libraries
- PHP-enhanced fallback: allows PHP to set the acceptance cookie so that everything degrades perfectly without the need for JS.
How to use
All you need to do is include the cookiealert.min.js script, then see the markup contained in index.html or index.php for usage examples. We've also included some sample CSS for styling your alert message.
We'll add more documentation in the near future, as the code gets improved and refined.
Extras
You'll also find some sample copy for your privacy / cookie pages in privacy.html.
Authors
- Paul Wilde
- Phil Powell