Accept Cookies / Cookie Consent Script (EU Cookie Law)

The EU cookie law went into effect in the UK in May 2012. UK's implementing guidance requires web sites to:

For more information, please see this nice "Everything You Need to Know About the Cookie Law in Five Minutes" article.

Demo

The cookie consent bar uses CSS3 transitions to fade in from the bottom of the screen. 'OK' dismisses the bar and sets a cookie for 90 days to keep it hidden.

Works in all browsers, but IE8/9 users forego the fade effect.

Please view the source of this page for HTML markup, CSS and JS.

Like Google and Twitter et al, the notification bar takes an 'implied opt-in' approach, which is to continue using cookies, but tell users that they're being used. Telling users that your site uses cookies is the absolute minimum - to further comply with the law, you should;

All of these things may appear in one 'cookie policy' document, but I've included 3 links in the demo to offer clear separation.

Clear Cookies

More demos and snippets

Did you find this useful? There are more demos and code snippets this way.