When I set a cookie on the client, his history still doesn't have that cookie. So when he presses back, he will get the page from his browser cache and the cookie won't be set on those cached pages unless he does a reload. What do I do in that case? How do I make sure that his cookie is set everywhere, even in history?
Asked
Active
Viewed 57 times
1 Answers
2
The cookie will either be set or not.
What is most likely happening is that you press back, you're getting a cached copy of the page, loaded when the cookie was not set. And if you think about it, that's correct - that's where you were, previously. It's the actual "history" of where you went.
Two routes you could follow:
Set the cache headers on the page in question so that it gets reloaded every time. If it's dynamically generated, this may be prefereable anyway.
Set an onLoad event on the page which will check for the cookie and reload if necessary (see also this post about page events and the back button)
-
okay, thanks. I just looked at other sites I occasionaly log into, they all seem to force reloads. It will be a little tricky to not force reloads unnecessarily. – Blub Nov 05 '11 at 11:24