Re: How to tell if client has cookies turned off?
| From: | (Chris Adams) | Date: | Tue, 06 Mar 2001 16:52:00 +0000 |
| Subject: | Re: How to tell if client has cookies turned off? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42772@lists.php.net to get a copy of this message | ||
On 6 Mar 2001 07:53:46 -0800, kevin1 <kevin1@outcomemail.com> wrote:
>How can I tell reliably if someone has cookies turned off?
Set a cookie on your site (perhaps the homepage?) and use code like this:
if (!empty($UserHasCookies)) {
echo 'Whew - you do have cookies';
}
The idea is to set your code to assume that cookie support is disabled unless
it finds a cookie saying otherwise. That way it'll fail safely if someone
either doesn't have a cookie or their browser discards the cookie halfway
through. This may seem silly, but some people get *really* paranoid about
cookies. Combined with the increasingly good cookie management in modern
browsers and just about anything is possible - this is in fact the major
shortcoming to code like the above - it's possible for someone to accept one
cookie and deny another, so just being able to set a cookie once does not mean
that you will be able to set another.
Chris