03 May 2012

Is new EU cookie law just the game of incompetent politicians? Be that as it may, we need to deal with it from May 1st.

New EU cookie law is yet another example of what happens when politicians try to set technical requirements having no clue about the technical aspects of the problem. Cookies have been around like what...almost since the birth of Internet itself and with small variations (like Adobe Flash cookies and recent HTML5 offline data saving) remain the one of the fundamental technologies every web-site uses. 

An honest person has nothing to hide (except for bank details probably), especially I can't see any problems with saving and keeping a small chunks of data helping other web-site owners to better serve me (like for example removing the necessity to enter login/password each visit). Granted, this is very arguable: I spend my youth in modern Russia where anyone could buy a CD with some 10 million people's records on home addresses, phones, occupation and other sensitive information. Clearly in many cases this presented a clear danger, economic or even physical, to the exposed people. But has nothing to do with harmless pieces of data called cookies. 

All the sites I've seen so far that have implemented cookie policy this or another way just inform visitors that they either need to leave the site or agree on using them. Essentially this became just a tickbox approach that does not provide any meaningful information to the regular users or the choice not to use them. 

Technically I've been asked to make a small adjustment to the client's site to make it compliant recently. This does not require a lot of skills or extensive programming. There's just a div with some text like 'Please be aware that this site uses cookies and we cannot do anything about it.' and cookie set on a user's computer after the first visit. So basically this message is shown just once and then does not bother the user anymore. The div can be located anywhere, for example on the very top of the page.

<script language="javascript" type="text/javascript">
  var cookiepolicy = getCookie("cookiepolicy");
  if(cookiepolicy != null) {
    document.getElementById('cookiediv').style.display = 'none';
}
else
{
   setCookie('cookiepolicy', '1', 365);  
}
</script>
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}
function setCookie(c_name,value,exdays) { var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; }
function del_cookie(name) { document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;'; }

 


Post a comment


RECENT BLOG ENTRIES
30 November 2013
Bigcommerce template editing
How to change content in BigCommerce.com templates: guide for a complete newbie.
Read full story
09 October 2013
What if Fancybox does not work at all
If Fancybox library does not work, this might be due to the conflicts with other JS libraries and not the syntax error.
Read full story
14 October 2012
Fancybox with ASP.NET form on Umbraco
Using ASP.NET form on Fancybox popup to make login window
Read full story

Blog archive

The author of this web-site supports WWF . Please do your part in saving our planet!

Alex’s expertise in developing and maintaining web applications has been invaluable to the College – J. Wittersheim, Director of Information Management and Funding, Bury College