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--%>
<% } %>
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--%>
<% } %>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
CJ