David L Posted April 20, 2012 Share Posted April 20, 2012 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 More sharing options...
Larry Posted April 20, 2012 Share Posted April 20, 2012 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 More sharing options...
David L Posted April 23, 2012 Author Share Posted April 23, 2012 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 More sharing options...
Larry Posted April 23, 2012 Share Posted April 23, 2012 I can appreciate that, and if there were a way to do it without the query, that'd be grand, but I think that approach would still be better than the redirect. Link to comment Share on other sites More sharing options...
Recommended Posts