Confirming cookie acceptance from the user

Various states and regions now require websites to ask their users if they approve of that website writing cookies to their computer. There is some debate as to how this can be provisioned by the website and what constitutes approval from the user. You may have noticed that recently websites display a notice to the user requesting approval. Something called Implied Consent is the current thinking; a notice is shown informing the user that if they continue to use the site they are happy with the cookies being written.

The following recipe does just that; and a notice is shown to the user that will disappear if they click on a link indicating they are happy with cookies being written.

Getting ready

We need ...

Get CodeIgniter 2 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.