I have set up a site which has a home page for each area they service. In Chrome and Safari if you goto the service areas tab and select a service area you will be taken to that areas home page.
At this point a session is started to store the users selected area and if they visit another page on the site it now displays a location specific ad in the header for that selected location or if they select home it will redirect them to their selected area home page.
The problem in Firefox is that if you select a service area and are taken to that areas home page then select a different page from the menu the set service area changes to a different area. This only occurs when leaving the custom home page to a different menu page.
This is the code that sets the session:
session_start();
$cur_url = dd_cur_page_url();
if ('local_home_pages' == get_post_type() && $cur_url != $_SESSION['dd_location']['home']) {
$cur_url_mod = str_replace('carpet-cleaning_', '', $cur_url);
$url_parts = explode('/', $cur_url_mod);
$url_parts_count = count($url_parts);
$cur_page = $url_parts[$url_parts_count - 2];
$location_parts = explode('_', $cur_page);
$place = trim(str_replace('-', ' ', $location_parts[0]));
$state = trim(str_replace('-', ' ', substr($location_parts[1], 2)));
$state_parts = explode('-', $location_parts[1]);
$state_abv = trim($state_parts[0]);
$county = trim(str_replace('-', ' ', $location_parts[2]));
$_SESSION['dd_location'] = array(
'home' => $cur_url,
'place' => $place,
'state' => $state,
'state_abv' => $state_abv,
'county' => $county);
}
And this is the redirect code which only runs on the generic home page:
session_start();
$cur_url = dd_cur_page_url();
if (is_front_page() && isset($_SESSION['dd_location']['home'])) {
$location = $_SESSION['dd_location']['home'];
header('Location:' . $location);
}
After some debugging with firebug I found the problem. It was in firefox’s prefetch. I added the following to my .htaccess file and everything is now working.
I will write a post on this issue coving how I found it, what to do to fix it, and why it occurred on my website http://www.dominant-domains.com within the next few days for those who are like me and want more than just a fix.
Thank you to the community for your suggestions. This was my first time here and it was a pleasurable one! Cheers