Browser sniffing
This article needs additional citations for verification. (August 2022) |
Browser sniffing (also known as browser detection) is a set of techniques used in
Sniffer 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:
var isIEBrowser = false;
if (window.ActiveXObject) {
isIEBrowser = true;
}
// Or, shorter:
var isIE = (window.ActiveXObject !== undefined);
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 was proprietary to Microsoft, a positive result will indicate that the client may be running Microsoft's Internet Explorer. This is no longer a reliable indicator since Microsoft's open-source release of the ActiveX code, however, meaning that it can be used by any browser.
Standard Browser detection method
The web server communicates with the client using a
Server-side sniffing
Extensive browser techniques enable persistent user tracking even if users try to stay anonymous. See device fingerprint for more details on browser fingerprinting.
Issues and standards
Many websites use browser sniffing to determine whether a visitor's browser is unable to use certain features (such as
See also
- Computer Programming
- HTTP
- Web browser
- Feature detection (web development) ("Browser sniffing" synonym in some contexts)
- Browser fingerprint
- Document Object Model
- User agent
- Web standards
- Content sniffing
References
- ^ Meiert, Jens (14 July 2021). The Web Development Glossary. Frontend Dogma.
- ^ "Browser detection using the user agent". mdn web docs. Retrieved 23 August 2022.