I’m trying to load an html page from a jsp file. like this. I give the file name to the jsp from a controller and using dojo I call another controller and pass the file name.
<script type="text/javascript">
var url = dojo.moduleUrl("dijit.form", "<c:url value="/getfile?Name=${fileName}"/>");
dojo.xhrGet({
url: url,
load: function(html){
dojo.byId("mycontent").innerHTML = html;
}
});
It streams the file contents to the jsp.
My problem is when I change the contents of the file it is not reflecting. For firefox I have to use Ctrl+f5 and for IE I’ve to clear the cache manually.
How can I avoid this?
I’ve given
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta HTTP-EQUIV="Expires" CONTENT="0"/>
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache"/>
in my the jsp files and html file.
Two ways:
Put it in the HTTP response headers, not in the HTML head. The meta tags are only interpreted when the file is opened from local disk file system, not when the file is obtained by HTTP. A
Filteris a perfect tool for the job. Plus, you forgot two moreCache-Controlsettings. Here’s a complete set:Map this
Filteron the desired URL pattern matching the HTML file.Add a timestamp to the query string so that the browser cache is fooled.