2012-07-16 73 views
0

如何在註銷時禁用瀏覽器緩存。我用:註銷時不活動的瀏覽器緩存

<meta http-equiv="cache-control" content="no-cache"> <!-- tells browser not to cache --> 
<meta http-equiv="expires" content="0"> <!-- says that the cache expires 'now' --> 
<meta http-equiv="pragma" content="no-cache"> <!-- says not to use cached stuff, if there is any --> 

但仍然我得到上一頁,當我點擊登出。

+0

你是什麼意思的'上一頁'。我想退出到'下一頁'。 – tom 2012-07-16 07:12:04

+0

考慮我登錄和導航這麼多頁面,當我註銷時,我應該允許從我的導航中訪問或查看以前的內容。當我點擊返回按鈕時,我應該顯示登錄頁面。 – Mohan 2012-07-16 07:47:31

+0

您是否在所有頁面上放置了緩存控件標籤?如果沒有,您的上一頁可能會在緩存中提供此問題。 – tom 2012-07-16 07:59:43

回答

0

這應該適用於大多數瀏覽器,但爲了防止Firefox高速緩存,您需要額外的兩個標頭Cache-Control=no-storeCache-Control=must-revalidate。因此請嘗試:

<meta http-equiv="expires" content="0"> 
<meta http-equiv="pragma" content="no-cache"> 
<meta http-equiv="cache-control" content="no-cache"> 
<meta http-equiv="cache-control" content="no-store"> 
<meta http-equiv="cache-control" content="must-revalidate"> 

請參閱how can i prevent firefox caching