Browser sniffing

Browser switches are techniques to circumvent differences in the representation of web pages in different browsers by offering different browsers for different code.

When designing websites, this results in problems that not all Web browsers support the equally standardized web technologies HTML, CSS and JavaScript. In particular, older browsers support this poorly and interpret things differently than intended. For example, use of Internet Explorer prior to version 6 and even in newer versions in quirks mode, a deviant from the standard box model. This has the consequence that will be correctly displayed in a browser web pages and wrong in others. However, the problem also affects modern browser, since no browser supports all standards completely. However, to achieve a uniform representation and functionality, are the authors of the websites partially browser switches ( engl. browser sniffing, dt browser (s ) sniff ) used to allow different browsers interpret the different code.

Techniques

Can browser switches on the server side (usually by reading the User - Agent header of your browser) by means of SSI, PHP or Perl and client side using CSS, JavaScript (for example, by testing for the presence of certain objects ) or ( in switches specifically for the Internet Explorer) Conditional Comments can be realized.

Due to the variety of browsers, it is not possible to offer its own version of a web page for each browser and version, browser switches can therefore also whole families of browsers ( browsers with Gecko, Internet Explorer version> = 5, etc. ) differ.

Another method is known as CSS hacks, in which the defective CSS interpretation is specifically used by older versions of the browser in order to bring them to that special behavior. From this technique, but not recommended because it can cause problems with newer versions of the browser.

Problems

The browser detection is not reliable in general, because most browsers allow you to transfer a custom User-Agent header and disable JavaScript.

Since search engines usually use a custom User-Agent header, browser switches can also be used to write false information about the content of a web page in search engines, for example, to increase the number of accesses (Search Engine spoofing ), for more advertising revenue through banner advertising.

148921
de