What is User-agent?
User-agent is a special string header that is widely used to indicate browser client information, allowing the server to identify the operating system and version of the client computer, CPU type, browser and version, browser rendering engine, browser language, etc.
Different browsers (Ie,ff,opera, chrome, etc.) use different user agent strings (the user agent Strings) as their own flags, and when a search engine (google,yahoo,baidu,bing) accesses a webpage through a web crawler, Also through the user agent string to carry out their own flag, which is why the website statistics report can statistics browser information, crawler information. The website needs to obtain the user client's information, understands the website content in the client's presentation form, some websites by the judgment UA to the different operating system, the different browser sends the different page, but this also may cause some pages to be unable to display in one browser normally.
The user agent string consists of 6 different parts:
As follows:
mozilla/5.0 (compatible; X11; U Linux i686;en-us) gecko/20081202 Firefox (DEBIAN-2.0.0.19-0ETCH1)
- mozilla/5.0 Browser flag: Includes app name Mozilla and version number 5.0;
- Compatible browser-compatible flag: Indicates support for major feature sets
- U encryption flag: This field is gradually canceled (n means no security encryption, I table weakness security encryption, u means strong security encryption)
- Linux i686 operating system flag: Linux
- En-US language mark: English
- gecko/20081202 render engine flag: Gecko
- Firefox (debian-2.0.0.19-0etch1) browser version info: Firefox
Why does the browser user-agent always have the word Mozilla?
Historical story in user-agent string: http://nonfu.me/p/8262.html#6704859-tsina-1-74270-c5f225ba0edaae7b53a5eca6ead5f75f
simple usage of user-agent:
- When a user accesses a website using FF, the Web site obtains the user's browser version through the user-agent string, and when it finds that the version of FF is unable to perfectly represent the content of the site, it presents a personalized prompt to upgrade the browser to present the latest WebGL and HTML5 content.
- The web site can give different CSS files based on the user agent string, ensuring that the best results are displayed on different browsers.
- Disguise the user agent to avoid certain Web sites that can be read by a specific browser.
Above transfer from: http://www.360doc.com/content/14/0218/02/15723785_353395087.shtml
get user-agent Value:
Use Request.getheader ("User-agent") in Java to get the user-agent of the browser
PHP using $_server[http_user-agent] to get
JS in the use of navigator.useragent obtained.
Obtained using request.header["User-agent" in ASP.
To modify common browser UA methods: http://www.zhixing123.cn/jiaocheng/40469.html
Chrome disguises the UA method to bypass detection. Specific method: http://blog.csdn.net/iceman03/article/details/20528771
Other extensions read:
User-agent string History: Http://www.kuqin.com/shuoit/20150312/345160.html,
Http://www.cnblogs.com/egger/archive/2013/04/20/3032070.html
The user-agent:http://www.cnblogs.com/iack/p/3557371.html of the major search engines
USER-AGENT:HTTP://BLOGREAD.CN/IT/ARTICLE/4063?F=WB of the Mobile browser
Major browser versions user-agent summary: HTTP://WEIBO.COM/P/230418AC467E560102VEBJ
Note: Many of the contents of this article has been summed up by netizens, in the process of learning UA, collected some of the better, also do not copy paste, RELATED links can be referenced. (I'm a hard-working porter ~^~)
Learning from the User agent