Articles: 843 | Categories: 148   
   
   
Home Articles Contact Us
 
 
 
 
Browser Redirect (0 Comments)
Admin: Posted Date: March 3, 2010

This is a simple little script which will take you to one page if you're using Internet Explorer, and another page if you're using some other browser. If the browser is Microsoft Internet Explorer, then go to spoono.com. Anything else, go to yahoo.com.

Browser Redirect

Learn how to do a Browser Redirect using the power of PHP.

Spreadshirt
Alright, this is a simple little script which will take you to one page if you're using Internet Explorer, and another page if you're using some other browser. Lets decide what this is going to do in English:
  1. If the browser is MicroSoft Internet Explorer (MSIE), then go to spoono.com
  2. If the browser isn't MSIE, then redirect to yahoo.com.



The most essential part of this is that this code has to be sent out before any output to the HTML page. Make sure it is the first line of code on your PHP page. With that said, here is the PHP:

 

//if its MSIE then
if ($name = strstr ($HTTP_USER_AGENT, "MSIE")) 
{ 
//go to Spoono
Header ("Location: http://www.spoono.com/");
} 
else 
{ 
//else go to Yahoo
Header ("Location: http://www.yahoo.com/");
} 
?> 

 
 
Add a Comment:
 
(You must be signed in to comment on an article. Not a member? Click here to register)
   
Title:

Comments: