Jump to content

Recommended Posts

Hey

 

How do i get get_browser() to check if the user is using IE or FF?

 

I also tried this: $_SERVER['HTTP_USER_AGENT']; but it gives me this when im using Internet Explorer 7.0:

 

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0)

 

???

Link to comment
https://forums.phpfreaks.com/topic/85357-get_browser-function-how-does-it-work/
Share on other sites

On my mac:

 

FireFox:  Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11

 

Safari:  Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/523.12.2 (KHTML, like Gecko) Version/3.0.4 Safari/523.12.2

 

Opera:  Opera/9.20 (Macintosh; Intel Mac OS X; U; en)

 

 

Looks like all you need to do to determine which is which is  something like this:

$userString = $_SERVER['HTTP_USER_AGENT'];

//and then search the string (strstr() or substr() or something similar) for keywords like "Firefox" "Safari" "Opera"

In your case, "MSIE 7.0" is the keyword. Test this script on older versions of IE to distinguish differences.

 

Hope this helps!

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.