Browser sniffing

Browser sniffing

Browser sniffing is a common technique used in websites and web applications in order to determine the web browser a visitor is using, and to serve browser-appropriate content to the visitor. This controversial practice is sometimes necessary because of incompatibilities between browsers in areas such as the interpretation of HTML, cascading style sheets (CSS) and the Document Object Model (DOM). While the World Wide Web Consortium maintains up-to-date central versions of some of the most important Web standards in the form of recommendations, in practice no software developer has designed a browser which adheres exactly to these standards; implementation of other standards and protocols, such as SVG and XMLHttpRequest, varies as well. As a result, different browsers will display the same page differently, and so methods have been developed to detect what web browser a user is working with so as to ensure consistent display of content.

niffer Methods

Client-side sniffing

Web pages can use programming languages such as Javascript which are interpreted by the user agent, with results sent to the web server. For example, here is a piece of code that might be used to determine whether a user is viewing a web page with Internet Explorer:

This code is run by the client computer, and the results are used by other code to make necessary adjustments on client-side. In this example, the client computer is asked to determine whether the browser can use a feature called ActiveX. Since this feature is to Microsoft, Inc., a positive result will indicate that the client is running Microsoft's "Internet Explorer".

erver-side sniffing

Client-side sniffing makes use of features on the client computer. These features must be available and active in order for the process to work. However, since the web server has no control over whether the client actually has the features available, client-side sniffing is unreliable. It is possible, however, to determine many features of the browser without depending on the client configuration. The web server communicates with the client using a communication protocol known as HTTP, or Hypertext Transfer Protocol. Information communicated between client and server usually includes information about the browser being used to view the web site. See user agent for more details on this.

Use

Browser sniffing can produce information on different aspects of the browser used. For example, it can detect which type of browser is being used (e.g., Internet Explorer, Netscape Navigator, Mozilla Firefox, Opera, Apple Safari) and which version of the software the client computer is running. Based on this information, the web server can provide a web page which will be structured appropriately for the user agent. Since browsers can vary significantly in their interpretation of a page, this can be an important consideration for web designers; consequently, there are a large number of scripts for browser sniffing available on the Internet and even commercial solutions such as BrowserObject or BrowserHawk.

Issues and standards

Browser sniffing has become a controversial practice in light of increasingly common use of alternative browsers such as Mozilla Firefox and Opera. Many websites use browser sniffing to determine whether a visitor's browser is unable to use certain features (such as Javascript, DHTML, ActiveX, or cascading style sheets), and display an error page if a certain browser is not used. However, it is virtually impossible to account for the tremendous variety of browsers available to users. Generally, a web designer using browser sniffing to determine what kind of page to present will test for the three or four most popular browsers, and provide content tailored to each of these. If a user is employing a user agent not tested for, there is no guarantee that a usable page will be served; thus, the user may be forced either to change browsers or to avoid the page. For this reason the World Wide Web Consortium, which sets the standards to be used in presentation of web pages, recommends that web sites be designed in accordance with its standards, and be arranged to "fail gracefully" when presented to a browser which cannot deal with a particular standardFact|date=October 2008.

ee also

*Web browser
*Document Object Model
*Computer Programming
*HTTP


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • browser sniffing — (Internet) ability of a web site to detect which browser version a user is running and to determine the browser s features and capabilities …   English contemporary dictionary

  • Browser-Weiche — Browserweichen sind Techniken um Unterschiede in der Darstellung von Webseiten in verschiedenen Webbrowsern zu umgehen, indem für unterschiedliche Browser unterschiedlicher Code angeboten wird. Bei der Gestaltung von Webseiten ergeben sich… …   Deutsch Wikipedia

  • MIME-Sniffing — Der Internet Media Type, auch MIME Type (nach der Spezifikation) oder Content Type (nach dem Namen des Feldes) genannt, klassifiziert die Daten im Rumpf einer Nachricht im Internet. Wie in dem Standard Multipurpose Internet Mail Extensions (MIME) …   Deutsch Wikipedia

  • User agent — A user agent is the client application used with a particular network protocol; the phrase is most commonly used in reference to those which access the World Wide Web, but other systems such as SIP use the term user agent to refer to the user s… …   Wikipedia

  • Client-side JavaScript — (CSJS) is JavaScript that runs on the client side. While JavaScript was originally created to run this way, the term was coined because the language is no longer limited to just client side, since server side JavaScript (SSJS) is now available.… …   Wikipedia

  • Comparison of JavaScript frameworks — Contents 1 Comparison of JavaScript frameworks 1.1 Rationale 1.2 Table of Javascript Frameworks 2 See also …   Wikipedia

  • Internet Explorer 6 — on Windows XP SP3 Developer(s) …   Wikipedia

  • Agente de usuario — Un agente de usuario es una aplicación informática que funciona como cliente en un protocolo de red; el nombre se aplica generalmente para referirse a aquellas aplicaciones que acceden a la World Wide Web. Los agentes de usuario que se conectan a …   Wikipedia Español

  • Usage share of web browsers — [ [http://marketshare.hitslink.com/report.aspx?qprid=0 qptimeframe=Q qpsp=38 Market share for browsers, operating systems and search engines ] ] legend|#00ffff|Other (0.26%)] Usage share, in web browser statistics is the percentage of visitors to …   Wikipedia

  • HTML5 video — HTML HTML and HTML5 Dynamic HTML XHTML XHTML Mobile Profile and C HTML Canvas element Character encodings Document Object Model Font family HTML editor HTML element HTML Frames HTML5 video …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”