Click to See Complete Forum and Search --> : Browsers and their Mysterious Headers


MstrBob
08-31-2004, 09:53 AM
Okay, well, I have known about this for some time. But now, I really want to know why. Why Browsers send the headers that they do. I used a simple $_SERVER['HTTP_USER_AGENT'] in PHP to grab the header of some common browsers:

Mozilla Firefox
Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.7) Gecko/20040803 Firefox/0.8
Internet Explorer
Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Win 9x 4.90)
Opera
Mozilla/4.0 (compatible; MSIE 6.0; Windows ME) Opera 7.54 [en]

Okay, so let's take a look at these headers, shall we?. Mozilla Firefox, seems to be alright. It tells us Windows, english, US, Gecko Engine, and Firefox 0.8. However, it tells us Mozilla 5.0??

Next, Internet Explorer, telling us its MSIE 6.0, which we expected, saying its Windows 98, even though I'm running ME. And it's calling itself Mozilla 4.0?! What's wrong with this picture?

Okay, and now Opera. The most confused of them all. It's calling itself Mozilla, MSIE 6.0, and Opera. *sigh* At least it got my OS right.

So can anyone explain to me why? Why are browsers sending these headers? How long has Mozilla been around? Why is IE and Opera using it? Is Opera then based off of IE? Was Mozilla the browser that Microsoft bought and built IE on top of? Wtf is going on?

AdamGundry
08-31-2004, 10:34 AM
Quirksmode (http://www.quirksmode.org/js/detect.html#link6) explains it quite well. Basically, it is for compatibility - all the browsers use Mozilla at the start to be compatible with Netscape, and Opera pretends to be IE to prevent servers providing different content (you can disable the option, however).

Adam