Jump to content
Larry Ullman's Book Forums

Header("Location") Redirects And Browser History Incompatibility Issues


Recommended Posts

Hey everyone,

 

I am running into issues using header("Location: x"), as the history (back/forward) buttons in browsers don't seem to keep track properly of the redirects.

 

It's complicated to put into words, so I made a screencast demonstrating the issue. Watch in full screen mode so you can see what I am doing. http://youtu.be/C2Fzkcp5kME

 

If anybody has a solution, I'd be very grateful.

 

Thanks!

Link to comment
Share on other sites

Hello David,

 

I'll just say that I'm not entirely keen on embedded videos in forum posts (I prefer no media in the forum) and I don't really like spending 4 minutes watching a video in order to help.

 

That being said, I think this is just a poor use of header(). Loading random.php and then going to another page is just poor design. How about having your page choose a random user ID and create the random link to that user's profile? Then it's a literal link and it should work in the browser's history.

Link to comment
Share on other sites

Larry, thanks!! I'll implement your suggestion. I didn't do it originally because I wanted to avoid adding an extra mysql query (to grab a random user_id) to every single page load, but I guess its the better way to go.

Link to comment
Share on other sites

 Share

×
×
  • Create New...