faqts : Computers : Programming : Languages : PHP : Common Problems : Tips and Tricks

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

13 of 24 people (54%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

How can I redirect different browsers to different pages?
How can I show a different page to each different browser?

Aug 8th, 1999 23:02
Nathan Wallace, Robert Aden


I guess you could use $HTTP_USER_AGENT to get the browser and then:

    if($browser == 'netscape') {
        Header("Location: http://the.server.com/netscape.html");
    } elseif ($browser == 'ie'{
        Header("Location: http://the.server.com/explorer.html");
    } else {
        Header("Location: http://the.server.com/default.html");
    }

I know netscape.com has a pretty uptodate javascript on their server 
that you might have a look at to see exactly how the matching should be 
done.