Hello,
I have a nifty little cookie-based home page redirection scheme going for my website. Basically, the first time a user browses to the website, they are presented with two choices (Products vs. Machining Services). When the user clicks one of the two buttons, a JavaScript function stores a cookie with the appropriate choice ("products" or "machining"). This cookie is set to be stored for 365 days.
Then, the next time the user visits the root level of the website (/), the following PHP code redirects them to the proper page:
<?php
// Pull last home page choice
$home_page_choice = $_COOKIE["HomePageChoice"];
if ($home_page_choice == "products") {
// Redirect user to Products page
header("Location: products/index.php");
exit();
} else if ($home_page_choice == "machining") {
// Redirect user to Machining Services page
header("Location: machining/index.php");
exit();
} else {
// Redirect user to first-time user home page (where user can choose where to go)
header("Location: home/index.php");
exit();
}
?>
If a user happens to click back to the Site Home page, that cookie will be cleared, ready for a new choice to be made. If you ask me, it's the cleverest code ever created! ;)
The problem is, FireFox for Mac (version 3.6) just doesn't seem to redirect properly (meaning it just goes to the last 'else' page, or 'home/index.php'; FireFox 3.6 for Windows works, as does IE 8 and Safari on both platforms. I know FireFox can read the cookie; I've tested it with "echo $home_page_choice;".
So what's going on with FireFox? I figure it must be a FireFox bug of some sort since PHP is a server based language and more-or-less browser independent.
-HazMatt