Posted on 2008-03-20 16:57
沙漠中的魚 閱讀(1242)
評論(1) 編輯 收藏 所屬分類:
其他
我們打開一個模式窗體,關閉,然后修改模式窗體里面要顯示的值,再一次打開之前打開的模式窗體,會發現里面的內容還是和原來打開的一樣,原是的瀏覽器把前一個頁面緩存起來了,打開這個頁面時,不會向服服務器請求數據,因些我們應當不緩存這些頁面
為了防止緩存,可以在頁面的頂端添加 response.expires = -1
使用java提供的方法,在jsp或者servlet中都可以 <% response.setheader("pragma","no-cache");
response.setheader("cache-control","no-cache"); response.setdateheader("expires", 0);
%>
使用NET在CS頁面在page load中把這句加上!
context.response.cache.setcacheability(httpcacheability.nocache);
使用html標記,如下面: <head> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0">
</head>