Full-service Internet Marketing & Web Development
Recent Posts

Sponsors
![]() |
Browser redirectCode Wizard, 12-30-2006 |
Simple script that gets the browser type from the http_user_agent and redirects to a page accordingly. I guess you could change the "redirect" to something else...maybe load in a different stylesheet for each browser...
<?php
// Redirect to: (must have trailing slash)
$redirect_uri = "http://www.your-domain.co.uk/";
// Page extension: (.htm .html .php .shtml etc)
$extension = ".php";
// start:
if ($name = strstr ($HTTP_USER_AGENT, "Opera")) {
$browser = "opera";
}
elseif ($name = strstr ($HTTP_USER_AGENT, "MSIE")) {
$browser = "ie";
}
elseif ($name = strstr ($HTTP_USER_AGENT, "WebTV")) {
$browser = "webtv";
}
elseif ($name = strstr ($HTTP_USER_AGENT, "Mozilla/4")) {
$browser = "nn4";
}
elseif ($name = strstr ($HTTP_USER_AGENT, "Mozilla/5")) {
$browser = "nn6";
}
elseif ($name = strstr ($HTTP_USER_AGENT, "Lynx")) {
$browser = "lynx";
}
elseif ($name = strstr ($HTTP_USER_AGENT, "w3m")) {
$browser = "w3m";
}
else { $browser = "unknown";
}
// redirect location
Header ("Location: $redirect_uri"."$browser"."$extension");
?>
|
|
Subscribe Now to receive new posts via Email as soon as they come out.
Comments
Post your comments

