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:
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 notify the user whether the browser should update the browser, and it can also help the user know the relevant information about 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
PS: JavaScript method to obtain browser address and parameters
Use javascript to obtain url address information
Execution uses javascript to obtain url address information. The code effect is as follows
location.host=www。dw。cn location.hostname=www。dw。cn location.href=http://www。dw。cn/news/2010-1/201011820131610618.shtml location.pathname=/news/2010-1/201011820131610618.shtml location.protocol=http:
Detailed introduction to window.location method to obtain URL
Uniform Resource Locator (URL) The complete URL consists of these parts:
scheme://host:port/path?query#fragment
Scheme: Communication protocol
Commonly used http, ftp, maito, etc.
Host: Host
Server (computer) Domain Name System (DNS) host name or IP address.
port:port number
Integer, optional. When omitted, the default port of the scheme is used. For example, the default port of http is 80.
path: path
A string separated by zero or more "/" symbols, generally used to represent a directory or file address on the host.
Query: Query
Optional, used to pass parameters to dynamic web pages (such as web pages made using CGI, ISAPI, PHP/JSP/ASP/ASP.NET and other technologies). There can be multiple parameters, separated by "&" symbols. The name and value of each parameter are separated by the "=" symbol.
fragment: information fragment
String, used to specify fragments in network resources. For example, if there are multiple noun explanations in a web page, you can use fragment to directly locate a certain noun explanation. (Also called anchor point.)
Example:
1, window.location.href
The entire URl string (the complete address bar in the browser)
Return value: http://www. dw. cn:80/index.asp?id=209#asp
2,window.location.protocol
The protocol part of the URL
Return value: http:
3,window.location.host
The host part of the URL,
Return value: www. dw. cn
4,window.location.port
The port part of the URL. If the default port 80 is used (update: even if: 80 is added), the return value is not the default 80 but a null character.
Return value in this example: empty
5,window.location.pathname
The path part of the URL (that is, the file address)
Return value: /index.asp
6,window.location.search
Query (parameter) part. In addition to assigning values to dynamic languages, we can also assign values to static pages and use javascript to obtain the corresponding parameter values
Return value:?id=209
7,window.location.hash
Anchor point
Return value: #asp

Detailed explanation of JavaScript string replacement method and FAQ This article will explore two ways to replace string characters in JavaScript: internal JavaScript code and internal HTML for web pages. Replace string inside JavaScript code The most direct way is to use the replace() method: str = str.replace("find","replace"); This method replaces only the first match. To replace all matches, use a regular expression and add the global flag g: str = str.replace(/fi

This tutorial shows you how to integrate a custom Google Search API into your blog or website, offering a more refined search experience than standard WordPress theme search functions. It's surprisingly easy! You'll be able to restrict searches to y

So here you are, ready to learn all about this thing called AJAX. But, what exactly is it? The term AJAX refers to a loose grouping of technologies that are used to create dynamic, interactive web content. The term AJAX, originally coined by Jesse J

This article series was rewritten in mid 2017 with up-to-date information and fresh examples. In this JSON example, we will look at how we can store simple values in a file using JSON format. Using the key-value pair notation, we can store any kind

Leverage jQuery for Effortless Web Page Layouts: 8 Essential Plugins jQuery simplifies web page layout significantly. This article highlights eight powerful jQuery plugins that streamline the process, particularly useful for manual website creation

Core points This in JavaScript usually refers to an object that "owns" the method, but it depends on how the function is called. When there is no current object, this refers to the global object. In a web browser, it is represented by window. When calling a function, this maintains the global object; but when calling an object constructor or any of its methods, this refers to an instance of the object. You can change the context of this using methods such as call(), apply(), and bind(). These methods call the function using the given this value and parameters. JavaScript is an excellent programming language. A few years ago, this sentence was

jQuery is a great JavaScript framework. However, as with any library, sometimes it’s necessary to get under the hood to discover what’s going on. Perhaps it’s because you’re tracing a bug or are just curious about how jQuery achieves a particular UI

This post compiles helpful cheat sheets, reference guides, quick recipes, and code snippets for Android, Blackberry, and iPhone app development. No developer should be without them! Touch Gesture Reference Guide (PDF) A valuable resource for desig


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment
