As follows:
1. Add the following where you quote the JS file:
//Modified on August 14, 2009
var now=new Date();
var number = now.getYear().toString() now. getMonth().toString() now.getDate().toString() now.getHours().toString() now.getMinutes().toString() now.getSeconds().toString();
document.write ("");
//alert("< script language="javascript" type="text/javascript" src="js/YearReportLuRu.js?" number "">");//Test
Similar to this In the form: js/YearReportLuRu.js?20100408154456, the browser will think that the js file referenced is different each time. Of course, our YearReportLuRu.js does not process the subsequent dynamic numbers.
2. Just add:
<%--No cache settings--%>
Server side plus:
Response.Buffer = true;
Response.ExpiresAbsolute = System.DateTime.Now.AddSeconds(-1);
Response.Expires = 0;
Response. CacheControl = "no-cache";
I have applied this method in the program, but some users still have caching problems, and I personally feel that it has not been finally solved.
3. There are other methods. I have not used them myself in this summary. I just found them online, as follows:
You need to set up caching on the server, so that the client will cache according to the client's settings. Some static files (such as: js, css, pictures).
In IIS, you can set "Enable content expiration" in the "HTTP header" of the site properties to control the client cache time. (As shown below)
The HTTP header returned by HTTP is 304. Enabling caching can greatly improve the user experience. It is also recommended to enable http compression to optimize the website.
This method is set on the WEB publishing server.
Summary: For static files, you can use IIS or other WEB SERVERs. Caching the client is a mechanism problem of IE or other clients.
Popular users still won’t clear the client’s cache. So we can use programs to control caching issues.