How come $_SERVER['HTTP_REFERER'] just about always starts with Mozilla even if the browser isn't Mozilla. Say even IE says its Mozilla then says its IE once in the brackets :confused:.
Printable View
How come $_SERVER['HTTP_REFERER'] just about always starts with Mozilla even if the browser isn't Mozilla. Say even IE says its Mozilla then says its IE once in the brackets :confused:.
A trick first used in the early days of Internet Explorer. The graphical capabilities of Netscape Navigator (which reported itself as "Mozilla/1.0") were so superior to all other browsers (which mostly were text browsers) that often servers would take the identifier string and check if the first parts was "Mozilla". If yes, it would send the graphical version of the page, otherwiser the text-only.
MS with their Internet Explorer of course wanted the graphical version for their users, so they made their id string start with "Mozilla" too, adding the word "compatible" in.
This has never been changed. Up to today, all mainstream browser id strings start with the word Mozilla. It is no longer a hint that it is actually a Mozilla browser, but instead a kind of hint at the capabilities of the browser. Mozilla/1.0 is the most basic graphics only. Mozilla/2.0 means slightly better graphics and JavaScript 1.0 (usually). Mozilla/3.0 means JavaScript 1.1 and maybe other things. Mozilla/4.0 means the currently most common browsers, with support for plug-ins, fancy graphics, JavaScript 1.2, often the DOM, CSS, etc. Mozilla/5.0 (currently only used by the real Mozilla, though Opera7 and Safari could use it, too) means the next generation: advanced and more complete CSS and CSS2 support, JavaScript 1.5 (not sure 'bout that one), XHTML support.
But it's still not good practice to use this.
I assume you'd guessed I didn't mean referer and meant agent, :blush:.
user agent. That's the term I was looking for constantly while writing this!