Jason
Jason

Reputation: 587

CodeIgniter - No cookies to be set unless agreed to by the visitor

Is there a simple way to make sure no cookies are set by CodeIgniter (ci_session) unless agreed to by the visitor?

"In the UK a new Cookie Regulation officially announced on 20th May 2011 and will be enforced from May 2012 that website owners must gain a visitor’s consent that they will be tracked by cookies on that website."

Many thanks!

enter image description here

Upvotes: 3

Views: 1702

Answers (1)

Laurence
Laurence

Reputation: 60048

Ironically, to track if a user wanted to use a cookie, you would almost need a cookie to know that :)

But thinking aloud - the solution would be to not create any cookies on the main page. Then in your view have a link: "click here if you accept cookies"

which directs to /yourcontroller/turnoncookies function

then in your function, load the session class, and create the cookie.

Upvotes: 1

Related Questions