0

How to disable browser cache when logout takes place. I used:

<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 -->

But still I am getting the previous page , when I click logout.

tom
  • 2,735
  • 21
  • 35
Mohan
  • 3
  • 2
  • What do you mean by 'The previous page'. I suppose logout goes to 'Next page'. – tom Jul 16 '12 at 07:12
  • Consider i login and navigating so many pages , when i logout , i should allow to access or view the previous from my navigation . i should show the login page when i click back button . – Mohan Jul 16 '12 at 07:47
  • Did you put the cache control tags on all the pages? If not your previous page might be in cache giving this problem. – tom Jul 16 '12 at 07:59
  • yes i put above cache control in all pages – Mohan Jul 16 '12 at 08:32

1 Answers1

0

This should work on most browsers, but to prevent Firefox from caching, you need an additional two headers Cache-Control=no-store and Cache-Control=must-revalidate. Therefore try:

<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">

See how can i prevent firefox caching.

Community
  • 1
  • 1
Kkkev
  • 4,716
  • 5
  • 27
  • 43