# Double click browser-back button behaviour in IE



## dannyman1234 (Apr 25, 2009)

Hi,

I am using a window.localtion redirect in Javascript to convert to SEO urls in an existing site. I didnt make the website from the beginning, so I'm using javascript to dynamically redirect pages to the SEO pages in cooperation with mod_rewrite:

2 examples:


{if $uri == '/index.php?id=6'}
<script type="text/javascript">window.location.href="products6.htm"</script>;
**/if}

OR

{if $uri == '/index.php?id=3'}
<script type="text/javascript">window.location.href="home3.htm"</script>;
**/if}


$uri is the old url. If I want to go back from products6.htm to home3.htm Then I have to click 2 times to go back a previous page. This only occurs in IE, in firefox and Safari, it works fine.

Doesn anyone know a fix for this?


----------



## WebDesignTuts (Jun 9, 2009)

We'll need the full code. You seem to be getting mixed up between JS and PHP.


----------



## jamiemac2005 (Jul 5, 2007)

Hey, i've never seen a single way around this. Mainly because you have a middleman style page, is there any way to consolidate the pages into one?

Either that or checking the referring url to see if it was the referred to page:

```
<?

if($_SERVER['HTTP_REFERER']=="http://www.whatever.com/products6.htm")**
//go to the previous page...
}

?>
```
Then again if you have multiple pages you're coming from then that's going to be a little more effort.

Cheers,
Jamey


----------



## dannyman1234 (Apr 25, 2009)

jamiemac2005 said:


> Hey, i've never seen a single way around this. Mainly because you have a middleman style page, is there any way to consolidate the pages into one?
> 
> Either that or checking the referring url to see if it was the referred to page:
> 
> ...



That is too much code for nothing. I thought there was a fix for it.

I tried the following:

<meta http-equiv="refresh" content="0;url='producten6.htm'" />
This solves the doubleclick problem, only, something else occurs what is not acceptable. It redirects one time, but after 1 second it refreshes.

Check it out here: http://www.exclusieve-babykleding.nl/producten6.htm
Cleck on any other link and then click back, you know what I mean.

I think I have to use php header location.



> WebDesignTuts We'll need the full code. You seem to be getting mixed up between JS and PHP.


I think you seem to get mixed up by missing the point. Nobody is getting mixed up between JS and PHP. They can work together just fine. The point is the javascript.locatio redirect, which will just not work correctly for IE


----------



## WebDesignTuts (Jun 9, 2009)

> I think you seem to get mixed up by missing the point. Nobody is getting mixed up between JS and PHP. They can work together just fine. The point is the javascript.locatio redirect, which will just not work correctly for IE


No, I'm not getting mixed up. They can work together fine, but in the example you provided, they won't.

window.location.href will work in IE4 +, FF1 +, and Opera 9 +.


----------

