Page 1 of 1

http user agent, doubt??

Posted: Tue Feb 21, 2006 4:27 am
by saumya

Code: Select all

$useragent = $_SERVER ['HTTP_USER_AGENT'];
echo "<br><b>Your User Agent is</b>: " . $useragent;
hi,
The above code shows me the same user agent in both ie and firefox,why??!!
Let me show you the results

ie6:
Your User Agent is: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)

Firefox:
Your User Agent is: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

though the version numbers are different but why its "Mozilla" always.

thanking you
saumya

Posted: Tue Feb 21, 2006 6:05 am
by Maugrim_The_Reaper
You missed out on the Browser war between Internet Explorer and Netscape... Lots of features on the net in the 90's were compatible with either Netscape only or IE only. So a lot of code (js) used the user-agent string to disable features for incompatible browsers.

As IE gained dominance and other browsers emerged they needed to outwit these limitations and so they started to "pretend" to be something else. Hence IE5+ have Mozilla 2.0-4.0 in the user agent string. It's a false ID basically to fool disabling code.

Reminds of that horror Hotmail did a while back in creating a full page warning about using Opera or Mozilla... :evil: . Some browsers actually support the ability for the user to change their user-agent string as a preference. :)

Posted: Tue Feb 21, 2006 6:25 am
by saumya
OHH MY GOODNESS!!!!!!!!!!
thank you so much.
So we can say, ie is faking itself to be mozilla core!!??

Posted: Tue Feb 21, 2006 6:33 am
by Maugrim_The_Reaper
Pretty much...;) Not sure if IE7 still carried the Mozilla4.0 compatible string or something updated. Probably still the same string I guess.

Posted: Tue Feb 21, 2006 6:59 am
by saumya
simply microsoft.
they can not make there own.I am confident that they will be go with the same.Lets see.
thank you so much.

Posted: Thu Feb 23, 2006 8:28 pm
by AKA Panama Jack
Well, you can't trust the user agent at all anymore. Some of the newer browsers allow you to change the user agent to anything. And you could go through some proxies that change the user agent.

With Opera you can spoof the user agent so you can look like any web browser out there.