Home > Web Front-end > JS Tutorial > body text

JavaScript obtains information icons from major browsers_Basic knowledge

WBOY
Release: 2016-05-16 15:31:01
Original
1246 people have browsed it

How to get browser information

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

The JavaScript code is as follows:
<div class="codetitle"> <span><a style="CURSOR: pointer" data="47539" class="copybut" id="copybut47539" onclick="doCopy('code47539')"><u>复制代码</u></a></span> 代码如下:</div> <div class="codebody" id="code47539">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("是时候升级您的浏览器了!"); } }<br> </div>

We can use this function to notify the user whether the browser should update the browser. It can also help the user to know the relevant information of the browser

Basic information about major browsers

The author has tested almost all current mainstream browsers. Of course, no matter how many browsers there are, they all use browser kernels such as Trident, Blink, Gecko, and Webkit. There will not be much difference in the analysis. I am attaching the relevant screenshots. As follows:

This is for Edge


IE11, the author does not use IE6, but there shouldn’t be much difference


Safari, the original poster is a Window system and the Safari version is relatively low


Sogou Browser, the original poster was obsessed with it for a while!


QQ Browser (WeChat version) is quite powerful. Now the author uses the most popular browsers besides Chrome, dual-core Trident and Blink, which are very fast under the Chrome kernel


The compatibility mode of 360 Secure Browser uses IE’s Trident kernel


Firefox, not much to say, genuine Netscape, a must-have browser for developers


Chrome. Now the most used browser by the poster, Google is really good, I strongly support it


360 Safe Browser speed mode, Chrome kernel, very fast

Code result analysis

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template