Prevent logon form display if cookies disabled

G

groupie

Hi,
If cookies are not enabled, can I prevent the logon form being
displayed? i.e. all I want is a message telling the user to enable
cookies.
e.g.
<body>
<script type="text/javascript">
if (!testSessionCookie ())
document.write("cookies disabled. please enable");
</script>
<noscript>
<p>Javascript is not enabled on your browser. Javascript and Session
Cookies need to be enabled to login.</p>
</noscript>
<form id="login" name="login" method="post" action="login_db.asp">
<td>Email address:</td>
<input name="email" type="text" id="email" size="50" />
<td>Password:</td>
<input name="pword" type="password" id="pword" size="40"</td>
</form>
 
J

Joost Diepenmaat

groupie said:
Hi,
If cookies are not enabled, can I prevent the logon form being
displayed? [...]

Well.. Have you tried setting a cookie and then reading it back?

*I'm not at all sure this will work*

Joost.
 
J

Joost Diepenmaat

Bart Van der Donck said:
Joost said:
groupie said:
If cookies are not enabled, can I prevent the logon form being
displayed? [...]
Yes.

Well.. Have you tried setting a cookie and then reading it back?

*I'm not at all sure this will work*

It's the only way.

What I actually meant was that I wasn't sure you could to that reliably
without going through the server and trying to read the cookie back on
the next page.
 
B

Bart Van der Donck

Joost said:
Bart Van der Donck said:
Joost Diepenmaat wrote:
If cookies are not enabled, can I prevent the logon form being
displayed? [...]

Well.. Have you tried setting a cookie and then reading it back?
*I'm not at all sure this will work*

What I actually meant was that I wasn't sure you could to that reliably
without going through the server and trying to read the cookie back on
the next page.

Sure, no problem - please see paragraph "All together now" on the link
that I posted.
 
G

groupie

Joost said:
Joost Diepenmaat wrote:
If cookies are not enabled, can I prevent the logon form being
displayed? [...]
Well.. Have you tried setting a cookie and then reading it back?
*I'm not at all sure this will work*
What I actually meant was that I wasn't sure you could to that reliably
without going through the server and trying to read the cookie back on
the next page.

Sure, no problem - please see paragraph "All together now" on the link
that I posted.

Thanks for the replies. I think my post was understood incorrectly: I
can test for cookies, but was asking how to bypass the page if they're
not enabled, but I found out how: I use the onload function in <body>
to test for cookies and redirect to another page automatically if not
enabled.

Thanks.
 
T

Thomas 'PointedEars' Lahn

groupie said:
If cookies are not enabled, can I prevent the logon form being
displayed? i.e. all I want is a message telling the user to enable
cookies.

Use server-side scripting; it is at *your* discretion, not at the user's.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top