Jump to content

Simple Browser Redirect


illestone

Recommended Posts

You can check the value of $_SERVER['HTTP_USER_AGENT'] and do a redirect based upon that value. However, that value can be spoofed by users if they really want to. So, it is not fool-proof. You would also have to determine how you will "decide" if the browser is IE or FF.

 

Here are the contents of that variable using versions of IE7 and FF3 on my PC:

 

- Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; GTB6.6; SLCC1; .NET CLR 2.0.50727; InfoPath.2; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; MS-RTC EA 2; MS-RTC LM 

- Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 GTB7.1 (.NET CLR 3.5.30729)

 

I'm sure there are some best practices, but I would guess you could check if the value contains "MSIE" or "Firefox"

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.