JavaScript access to the major browser information icon _ basic knowledge

Source: Internet
Author: User

How to obtain browser information

Window has a navigator object that lets us know all about the browser. We can use a series of API functions to learn about the browser's information.

The JavaScript code is as follows:

复制代码 代码如下:
function message(){ txt = "<p>浏览器代码名: " + navigator.appCodeName + "</p>"; txt+= "<p>浏览器名称: " + navigator.appName + "</p>"; txt+= "<p>浏览器平台和版本: " + navigator.appVersion + "</p>"; txt+= "<p>是否开启cookie: " + navigator.cookieEnabled + "</p>"; txt+= "<p>操作系统平台: " + navigator.platform + "</p>"; txt+= "<p>User-agent头部值: " + navigator.userAgent + "</p>"; document.getElementById("example").innerHTML=txt; if ((navigator.appName=="Netscape" || navigator.appName=="Microsoft Internet Explorer") && (parseFloat(navigator.appVersion)>=4)){ alert("您的浏览器够先进了!"); } else { alert("是时候升级您的浏览器了!"); } }

We can use this function to inform the user whether the browser should update the browser, but also to help users know the relevant information about the browser

Basic information for each major browser

Landlord test almost current mainstream browser, of course, no matter how many browsers are trident,blink,gecko,webkit of these kinds of browser kernel, parsing will not have too much access, is attached to the relevant screenshots are as follows:

This is the edge.


IE11, the landlord did not use IE6, but should not have too much discrepancy


Safari, the landlord is Window System Safari version is relatively low


Sogou Browser, once the landlord has also been infatuated with it for some time!


QQ Browser (micro-letter version), compared to the force, now the landlord in addition to chrome with the most browsers, dual-core Trident and Blink,chrome core under the fast


360 Secure browser compatibility mode, with IE's Trident kernel


Firefox, not much said, Netscape genuine, developers must browser


Chrome. Now the most used by the landlord browser, Google is really good, the force is very


360 Secure browser speed mode, chrome core, fast

Code Result analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.