[Zope] Re: Checking if cookies enabled

Lars Heber Lars.Heber@t-systems.de
Sat, 24 Nov 2001 12:52:48 +0100


Another possibility without using any JavaScript, thus independent from
the JS settings of the user is:

DTML method cookieTest:

<dtml-call "RESPONSE.setCookie('cookiesAllowed', 'yes')">
<html><head>
<meta http-equiv="refresh" content="0; URL=cookieTestComplete">
</head>
<body>
<a href="cookieTestComplete">Redirecting to cookieTestComplete...</a>
<dtml-var standard_html_footer>


DTML method cookieTestComplete:

<dtml-var standard_html_header>
<dtml-if "REQUEST.cookies.has_key('cookiesAllowed')">
  <h1>Cookies are allowed!</h1>
<dtml-else>
  <h1>Cookies are not allowed!</h1>
</dtml-if>
<dtml-call "RESPONSE.expireCookie('cookiesAllowed')">
<dtml-var standard_html_footer>

Successfully tested with NS 4.78, IE 5.0.

There could perhaps be problems if the users has (somehow) turned off
auto-redirecting... That's why there is the link left in cookieTest.

--
Lars Heber, mailto:Lars.Heber@t-systems.de

T-Systems, debis Systemhaus GEI GmbH, Geschaeftsstelle Sachsen