u can also write a javascript function in ur jsp file.
the object is navigator.cookieEnabled.it returns a boolean value.
piece of code will be

function chkCookie()
{
  if(navigator.cookieEnabled){
   alert("Cookies are enabled on client machine");
     }
}

-----Original Message-----
From: Charles Luo [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 02, 2001 6:32 AM
To: [EMAIL PROTECTED]
Subject: cookie detection


hi,

I am wondering if we can detect whether a client has cookie enabled or not
by using jsp and WebLogic commerce server 3.2 running at the backend.

I have tried to use response.encodeURL("/testing/testing.jsp") to return me
an encoded string. In theory, an application server (supports URL rewriting)
encodes the specific URL by including the session ID in it, or, if encoding
is not needed (i.e. coookie is disabled at client site), returns the URL
unchanged. So

I wrote the following code:

String originalURL="/testing/testing.jsp";
  String encodedURL=response.encodeURL(originalURL);
  out.println("<br>"+encodedURL);

  if (encodedURL.equals(originalURL))
    out.println("<br>Sorry, please enable your cookie function");
  else
      out.println("<br>Enjoy exploring our site");

However, I always get "Enjoy exploring our site" as my WebLogic Commerce
Server always include a session id in the returned URL.

Do I understand encodeURL correctly? Any ideas about cookie detection?

Cheers,
Charles Luo

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to