怎么保证html页面不被缓存

    技术2022-05-11  75

    保险起见,对html页面和jsp最好都加一些设置

    对于HTM网页,加入:

    <meta HTTP-EQUIV="pragma" CONTENT="no-cache">

    <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">

    <meta HTTP-EQUIV="expires" CONTENT="0">

    然后,jsp页面中加入:

    <%     response.setHeader("Cache-Control","no-store");     response.setHeader("Pragrma","no-cache");     response.setDateHeader("Expires",0); %> 就可以了

    其他的页面

    ASP网页 Response.Expires = -1 Response.ExpiresAbsolute = Now() - 1 Response.cachecontrol = "no-cache"

    PHP网页 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache");  


    最新回复(0)