Page 1 of 1

Back button

Posted: Sat Nov 05, 2005 9:49 am
by Ree
Is there a way to check if the page was accessed using browser back button? I guess it's not possible, but I thought I'd ask anyway.

Posted: Sat Nov 05, 2005 12:37 pm
by shiznatix
the only thing i could think of would be to have a complex session system and have each link have a id on it and do somthing like that, make a little map of some sorts. it would be possible but it would be rather hard to do.


mmmaybe, when there is a link on the page it auto increments some get id on that link and then the session as well and then if the user hits back the old links might still have the same old id...somehow...and then you would be able to check that againt the session id but i don't know if this is really possible

Posted: Sat Nov 05, 2005 3:09 pm
by feyd
using the back button on most browser will pull the page from cache, barely, if at all, hitting the server it relates to in the process. The only way you can detect such a thing is through a client-side script that checks the history object of the DOM.

Posted: Sat Nov 05, 2005 3:34 pm
by Ree
Well, I can always make the page uncacheable.

Posted: Sat Nov 05, 2005 3:37 pm
by feyd
That doesn't mean the browser won't cache it. Is it really all that necessary to put your server through the stress of serving this particular page constantly?

Posted: Sat Nov 05, 2005 3:57 pm
by Ree
The thing is, that the pages themselves are not cached anyway (without my intention). I have a search present on the site, which actualy is taken from another site via cURL. The search form is dynamic, that is, if you select some option it automatically generates additional selection options - all of this is taken from the original site everytime a site visitor does a request. When the form is submitted, the search results are displayed (again, taken from the original site). Now if the user clicked back after submitting the form, he would see an empty form and I can't seem to do anything about it. That's why I want to check if the search form was accessed by pressing back, and then simply redirect to the fresh form. As I mentioned, the caching just does not happen when navigating through search result pages (even if I use only GET), and overall the site I take info from is on ASP .NET with a login and plus https and automatic logout, and it's very strict to what requests can be made at which point so I'm having a bit of a problem with that.