Link to home
Start Free TrialLog in
Avatar of schroom
schroom

asked on

jsp or javascript - cookies enabled

I was using the followign script - and all is good except
that is was discovered that when a person first opens there browser and if they first go to the page with this code, they will be forwarded to the disable cookies page even if there cookies are not disable, a refresh will solve the problem, but is there another way???

<%-- if cookies are disabled - will forward to enable cookies page--%>
<%
   String cookies = request.getHeader("Cookie");
   boolean  cookiesEnabled = true;
   if (cookies == null) {
   cookiesEnabled = false;
%>  
   <jsp:forward page="enable-cookies-e.jsp"/>
<%
   } else {
%>
  <%-- cookies are fine - stay here--%>
<% } %>
Avatar of CJ_S
CJ_S
Flag of Netherlands image

Write a cookie first then read the cookie. Don't know the JSP code.

CJ
ASKER CERTIFIED SOLUTION
Avatar of OMC2000
OMC2000
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial