PrefaceUsually when making h5 pages, you need to do some traffic diversion work within the WeChat, QQ, Weibo and other ecosystems, but the traffic diversion is limited by these platforms. For example, the last article "h5 wake-up app implementation and points to note" is a compromise. So what are the User Agents of these commonly used browsers like? How to judge? Let’s take a closer look at this issue today. User Agent DefinitionUser Agent is the Chinese name for User Agent, abbreviated as UA. It is a special string header that enables the server to identify the operating system and version, CPU type, browser and version, browser rendering engine, browser language, browser plug-ins, etc. used by the client. ---From Baidu Encyclopedia From this sentence, we can know that we can obtain information such as the operating system and version, CPU type, browser and version used by the user through UA, right? Several common browser UAOnly WeChat, Weibo, QQ and other browsers are obtained here. The rest are not obtained yet. If you have any additions, please send a private message or leave a comment. Android The Android version currently used is Huawei Honor V9 Play, the current Android system version is 7.0 and the EMUI version is 5.1. QQ Browser
apple Apple currently uses iPhone 6s Plus, and the current iOS version is 12.4. QQ Browser
All the above UA values are processed by toLowerCase, so they are all lowercase. Determine several commonly used browsers separatelyBefore judging, you need to do an operation on UA, which is to convert all letters into lowercase, which can be achieved through toLowerCase, and then judge them separately. It is actually very easy to judge through the above UAs. There is already a way to write this in the last article, as follows: /micromessenger/i.test(u) // Check WeChat u.indexOf("weibo") > -1 // Check Weibo u.indexOf("qq") > -1 // Check QQ u.indexOf("mqqbrowser") > -1 // Determine QQ browser Note that QQ requires a space before qq. Get additional informationIt is not difficult to see from the above UA that the current system can be determined by UA, whether it is Android or iOS, which can be distinguished by the following code: /android/i.test(UA) //Judge Android /(iPhone|iPad|iPod|iOS)/i.test(UA) //Judge iOS The above data also shows the specific type of mobile phone, which I will not introduce in detail here. In addition, many mobile browsers can change UA, such as Quark and UC. If you study it in depth, you can get more information. SummarizeThis concludes this article on how JavaScript can determine several commonly used browsers through userAgent. For more relevant JS userAgent browser determination content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: mysql code to implement sequence function
>>: How to implement MySQL master-slave replication based on Docker
Table of contents 1.parseInt(string, radix) 2. Nu...
Error scenario Use the mysql command in cmd to ad...
Preface In LINUX, periodic tasks are usually hand...
<br />Tips for making web table frames. ----...
Table of contents Product Requirements Ideas Prob...
Table of contents 1. Background 2. What is a virt...
Table of contents introduction 1. Case Overview 2...
Table of contents getApp() Define variables at th...
1. The effect diagram implemented in this article...
Slow log query function The main function of slow...
One environment Alibaba Cloud Server: CentOS 7.4 ...
Table of contents 1. Introduction to calculator f...
Original text: https://dev.mysql.com/doc/refman/8...
Table of contents 1. React Basic Usage Notable Fe...
1. Make sure the system has the required libaio s...