View Full Version : redirect basec on browser

02-05-2007, 02:10 AM
i need a php script that will redirect all IE users to a specified url and all other browsers to a different url

thanks in advance :thumbsup:

**its redirect based on browser**sorry!

02-05-2007, 02:20 AM
Can't be done in PHP because the PHP runs on the server and the only info passed to the server as to what browser it is comes via the useragent and all browsers claim to be Internet Explorer in that field (at least part of the time).

You could use HTML.

<!--[if IE]>
IE specific code goes here, all other browsers will treat is as a comment
<!--[if !IE]-->
code for other browsers goes here

02-05-2007, 02:54 AM
I found this on the internet (see attached file).
It seems to work for me. Detach it and change the
extension to .php Then upload into the same directory
as your PHP script.

Play around with it and see what you find.

This is the part in your PHP script that utilizes "browser.php":

$br = new Browser;
echo "$br->Platform, $br->Name version $br->Version";

02-05-2007, 03:29 AM
thank you for that , but how do i get it to send the user to a page for ie and a different page for everything eylse

02-05-2007, 03:42 AM
something like this ....

$br = new Browser;
//echo "$br->Platform, $br->Name version $br->Version";
if($br->Name === "MSIE"){
header ("location: my_ie_page.php");
elseif($br->Name === "Firefox"){
header ("location: my_firefox_page.php");
header ("location: default.php");


02-05-2007, 04:06 AM
thank you it works great

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum