Retaining PHP Session Values in javascript's history.back()

Programming for Search Engines 101. An area for avid PHP and .NET developers to chat about Programming techniques and how to make better use of search engines.

Moderator: Moderators

Retaining PHP Session Values in javascript's history.back()

Postby shyam » Tue Sep 08, 2009 2:50 am

Hi all,

Thought would share this info with everyone.
Recently in one of the projects I was working on, Wynsum Homes, we had this strange issue with “Back” button. Yeah; the same old button with javascript:history.go(-1) code in it.

We had a search result page and the detail page of the concerned record in this site. But once we were in the detailed page, when clicked on the “Back” button, we used to get the session expired error in IE, though it worked in FF.

Debugging further, found out that it was actually the session values that was being used in the search result page that was causing the error.

Researching further on this issue, I struck upon a possible fix in one of the articles found online.

Giving the following header on the required page right after calling session_start(),
header("Cache-control: private");

we can actually direct the user to access the previous page with the values fetched before.

Thus I could direct the user from the detailed page of a particular record to the search result page.

Regards
Shyam
shyam
 

Re: Retaining PHP Session Values in javascript's history.back()

Postby tonyantony » Tue Sep 08, 2009 4:54 am

good post shyam. I am sure that it will help in coming projects.
tonyantony
 


Return to Programming

Who is online

Users browsing this forum: No registered users and 7 guests