Working HTTP Cache Control Headers For Smartphones,Tablet and web browser. When I was working on a mobile version of my website I encountered a problem. My goal is to tell the browser to never cache my webpages. I'd like every browser to do this - Chrome, Firefox, Internet Explorer, Safari, iPhone's browser, Android phone's browser, etc.
I used the following HTTP cache control code jsp, I include below jsp file in othere jsps using <%@include file="myjsp.jsp"%>. It is working fine for web browsers but not for mobile browsers.
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
contentType="text/html;charset=UTF-8" isELIgnored = "false" %>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<%@taglib prefix="c2" uri="http://java.sun.com/jstl/core_rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="sec"
uri="http://www.springframework.org/security/tags"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%
response.setHeader("Cache-Control",
"no-cache, no-store, must-revalidate"); // HTTP 1.1.
response.setHeader("Cache-Control",
"post-check=0, pre-check=0', false");
response.setHeader("Pragma", "no-cache"); // HTTP 1.0.
response.setDateHeader("Expires", 0); // Proxies.
%>
What's wrong with these headers?
Do you have the same problem where your HTTP cache control headers work on some browsers and not the others?
And is there any specific diffirence between mobile and desktop browser.