For my current project I need a detection if the cookies are enabled or not in the user’s browser.
The easiest way to do this is by using this code:
The CakePHP way is almost similar:
Ok, it’s not rocket science, but it helps
For my current project I need a detection if the cookies are enabled or not in the user’s browser.
The easiest way to do this is by using this code:
The CakePHP way is almost similar:
Ok, it’s not rocket science, but it helps
Posted in JavaScript, Labs, PHP
You can follow any responses to this entry through the RSS 2.0 Feed. You can leave a response , or trackback from your own site.
© 2010 Blog for web development · Proudly powered by WordPress & Green Park 2 by Cordobo.
Valid XHTML 1.0 Transitional | Valid CSS 3
Hm, are you sure this works? From the setcookie documentation: “Cookies will not become visible until the next loading of a page that the cookie should be visible for. To test if a cookie was successfully set, check for the cookie on a next loading page before the cookie expires.”
Daniel, you are absolutely right. That’s why I changed the code in the post.
My mistake is that I disabled/enabled the cookies without deleting them.
Probably I should leave this check to the JS, as it should be.