Hi guys,

Im in the middle of writing my own custom cms, and ive found a frustrating bug I cannot get rid of!

When the user logouts, they can use the back button the trace back through the pages theyve been on. However refreshing the page shows them as logged out and they cant see things again.

I've put this down to the backbutton using some sort of cach to remember pages? So it dosnt need to reload then?

I read about and found

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

is supposed to stop the caching, but that hasnt solved the problem.

I also would have thought using header() to redirect the page would refresh it and it would have to reload when using back but it dosnt.

Ive next tried a ajax method of assigning a cookie on logout, and if its set using the unload event to force them back to the login page.

this works, but i feel its very messy/hack job and it only works in FF.

Any suggestions of where im going wrong/solutions?

Thanks in advance! =)

When they logout you could close the current window and open a new window with the logout / login info.

Member Avatar for P0lT10n

is a browser problem... the browser dont refresh... it's hard to solve that...

hmmm so this is a common problem?

the reason I was thinking AJAX is because I noticed that if you try logging out and hitting back in something like Facebook, it forces the redirect and seems to fix it even if you try to go back more than one page etc

However my AJAX isn't that good so it doesn't work to well.

So is there no simple/safe/secure fix? I just need to hack my way round?

thanks again to those who replied =)

Member Avatar for P0lT10n

mmm... i dont know how works facebook on what you said... i think that you need java to process, ex. you need to show a page, show it using ajax, if the user dont have javascript it wont load, and when you loaded the page call ajax function for show page... it's a little hard to understand this...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.