FREE EU Cookie Law Script

The EU Cookie Law deadline was the 26th May and if you haven’t already implemented the changes then we’ve put together a little bit of code to help you. Feel free to use this script on your site. A link back to our site would be grateful but not mandatory. Also, please do leave a message saying where and how you’ve implemented it.

Bear in mind you’ll still need to get your web developer to add this to your site as this is just the bare bones version and you’ll need to style it up a bit. If you haven’t already clicked “Accept” on the Dare to Think site then you’ll see how we’ve added a banner to the top of the site.

If you need either script added to your site or you’re unsure where to start please do get in touch for a quote.

NOTE 14/6/12: Thanks to Pete Norris of Liquid Engine as I think he’s managed to solve the mysterious reason why these scripts weren’t working in IE. I’ve changed the scripts below as well as uploaded new files for you to download

Version 1 – The user clicks “Accept” before the message is removed

This shows a message to the user and they must click the “Accept” button before the message is removed. After they click the link then a cookie is stored on their computer so the message doesn’t display again until the year 2022!! If you would like to change the cookie expiry date then change the 365*10 code below (365 is the number of days and 10 is the number of years).

Download version 1 of the Free EU Cookie law script now

Version 2 – The user only sees the message once

This shows a message to the user once and then stores the cookie so it is never shown again.

Download version 2 the Free EU Cookie Law script now

  • Inkwnothing

    Sorry, but neither work using IE

    • daretothink

      Hi. Thanks for pointing that out. It appears that when you copy and pasted the script direct from the site that it somehow broke the script. Very strange and it did the same for me. I’ve now added downloadable files instead. Please try again and let me know how you get on.

    • daretothink

      I’ve now also fixed the code above so you can either download it or simply copy. Let me know how you get on.

  • http://arcdigitalmedia.co.uk Michael Guthrie

    Hi, Nice script. What is the jquery include needed for?

    • daretothink

      Thanks. That’s there so the .remove and .show work. If you remove it the div will not appear.

      • http://arcdigitalmedia.co.uk Michael Guthrie

        Ah great, thanks for your reply. We used the downloadable zip version and it works in IE8 but not  IE9

        • daretothink

          I’ve tested this in IE7, 8 and 9 as well as FF, Chrome and Safari on both Mac and PC. Are you sure you’re clearing your cache in IE each time you test it? Do so by going to Tools > Safety > Delete Browsing History and make sure the Cookies checkbox is checked.

          • http://arcdigitalmedia.co.uk Michael Guthrie

            oh yes, definitely clearing cache, deleting cookies, etc; it just displays, but doesn’t go away. seems it is not setting the cookie, even when we have accept all cookies selected and most minimal security settings.

          • daretothink

            Hi Michael. That’s very strange. Do you have a link to which I can see this in action?

          • http://arcdigitalmedia.co.uk Michael Guthrie
          • daretothink

            Just tested that site on a Mac (Safari, Chrome and Firefox) and PC (IE9, IE8, IE7, Chrome, Safari, Firefox) and is working on all.

          • http://arcdigitalmedia.co.uk Michael Guthrie

            Hmm, I wonder then, I was having significant problems on windows xp and ie 8 on my machine and also on a VM on linux running xp and ie8. our windows 7 machine and ie 9 isnt working for any of the urls

          • daretothink

            Hmm, indeed. I don’t really know what to suggest Michael. I’m very sorry I can’t be of any further help.

          • http://eurapart.com John Williams

            I’m having the same difficulty as Michael with IE9. Are you using the code as available in the download to test or the code as implemented on your site?
            eurapart.com/c2.php or eurapart.com/c2.html neither work with IE9

          • daretothink

            Hi John. Both of those are working in IE9 on my machine. I’m using Parallels Desktop on my Mac to run Windows 7 with IE9 installed.

          • daretothink

            I have set up two test urls: http://www.daretothink.co.uk/cookietest/test-1.php (will set a cookie called dttcookie1) and http://www.daretothink.co.uk/cookietest/test-2.php (will set a cookie called dttcookie2)

          • http://eurapart.com John Williams

            Alan, I’ve changed my browsing settings to accept all cookies but to prompt for each one. On this page the cookie for your script comes up in the prompts along with Google Analytics, Disqus etc etc. Clicking accept does not clear the bar and even refresh straight afterwards does not get rid of it for me.
            My links do not prompt me to allow a cookie and neither do the two URLs above.
            Getting some strong reminders why I gave up IE years ago…

          • daretothink

            It’s always frustrating when I can’t replicate the issues you are experiencing. I’ll try to have another delve into the mysterious world of IE at the weekend and report back. I have your email address so I’ll email you directly if I manage to find anything.

          • http://eurapart.com John Williams

            Thank you. I may well go ahead with it in any case as it works well on Firefox, Chrome, SeaMonkey. The worst case scenario is that it just remains at the top of each page.

          • http://www.liquidengine.com/ Pete Norris

            I’m no programmer, but I also couldn’t get it working in IE7 and IE8…. 
            However removing the 2 console lines of code fixed it.

            Thanks for the code!

          • daretothink

            Thanks Peter. I’ve amended the code above and for the downloads and hopefully this should work for all now.

  • http://eurapart.com John Williams

    I have one at eurapart.com/c2.html or eurapart.com/php

  • Pete

    Doesn’t work in Internet Explorer

    • daretothink

      What version? What OS? Works perfectly on my Windows 7 running IE9 and then running IE8 and IE7 within.

  • Pete

    Thanks for the code, do you have to have jQuery 1.7.2 for this to work or will it work with jQuery 1.7.1? I’ve implemented it onto my Magento site and it’s breaking my drop down navigation and AJAX layered navigation. Don’t really know anything about jQuery so don’t know how to fix it

    • Pete

      It’s only breaking when I use . If I remove it to use the jQuery already on the site it doesn’t work at all. PS. I’m not the same Pete that says it doesn’t work in Internet Explorer.

      • Pete

        I’ve worked it out now, jQuery wasn’t loading properly so I changed $(“eucookielaw”).show(); to jQuery(“eucookielaw”).show(); and that’s sorted it. You can see it here http://www.displaywizard.co.uk

        • daretothink

          Thanks for letting me know. Yes, I sometimes have this where sometimes I need to use $ and sometimes jQuery!

          • Pete

             Yeah, something I have only just learnt :) also I’ve tried this in IE8, IE9, Firefox, Google Chrome on Windows and Safari, Firefox and Google Chrome on OS X and it works on all of them. So thank you very much for the code

  • Jacob

    I like this; it would be even better if the second one had a click to close button like the first one does – I can see people wanting to close it right away and not being able to do so.

    I’m trying to get such a button to work … but my JavaScript is on a par with my French …

    • daretothink

      Hi Jacob. Unfortunately I do not have any spare time at present to implement this request. You could try this script and adding a button with the class of “remove”.

          $(“.remove”).click(function () {      $(this).parent().remove();    });

  • Pingback: The EU cookie law (e-Privacy Directive)

  • free-social-icons

    Free and Simple Social Media Icon Set

    A simple, clean and bold social media icons set (also includes a few other icons). The set comprises of 59 icons including variations. Available to download in 48px, 32px and 24px PNG format and also available as a fully grouped and layered Illustrator file allowing you to change the background colour to whatever takes your fancy.

  • dare-to-think-square

    Blogger to WordPress Import

    If you’re wanting to move your blog from Blogger to Wordpress then here’s a short guide on how do so. Follow the steps and you’ll have your new Wordpress blog set up in no time…

  • dare-to-think-square

    BETA Launch of Interview Hub

    Today (actually last week, but I’ve only just got around to writing about it) saw the BETA launch of INTERVIEWHUB.The site provides a unique marketplace enabling journalists, with celebrity contacts, to publicise their pitches both online and via their email newsletter (also created by Dare to Think). The site will be seen by thousands of […]

  • dare-to-think-square

    Show and hide text in a form field using onclick and onblur

    A great way to reduce the need for a field heading/title is to include the informative text within the text field. This is most commonly used in search fields, where there’s often no further available room to include a heading alongside or above.So from having a black search field like this: You can have one […]

  • apple-mail-signature-creation

    Remove attachments from Apple Mail emails

    Attachments can be pretty big and more often than not once you receive an email you’ll have saved that attachment to your Mac for safekeeping. Before you know it you’ll have hundreds of megabytes of emails on your Mac and wondering how on earth to make them smaller. I need to refer back to emails […]