Home > Common Problem > How to determine the browser type on mobile phone (JavaScript)

How to determine the browser type on mobile phone (JavaScript)

奋力向前
Release: 2021-07-06 13:20:37
forward
2468 people have browsed it

Introduces in detail the JavaScript mobile terminal to determine the browser type. Currently, it mainly supports Android, Apple, iPad, WeChat and Alipay. Whether it is the mobile terminal.

How to determine the browser type on mobile phone (JavaScript)

This article mainly introduces in detail a simple example of how to determine the browser type on the JavaScript mobile phone. It has certain reference value and can be used for reference.

Determine the browser type on the mobile phone

BrowserInfo = {      
  isAndroid: Boolean(navigator.userAgent.match(/android/ig)),      
  isIphone: Boolean(navigator.userAgent.match(/iphone|ipod/ig)),      
  isIpad: Boolean(navigator.userAgent.match(/ipad/ig)),      
  isWeixin: Boolean(navigator.userAgent.match(/MicroMessenger/ig)),      
  isAli: Boolean(navigator.userAgent.match(/AlipayClient/ig)),
  isPhone: Boolean(/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent))
}
Copy after login

Currently it mainly supports Android Apple iPad WeChat Alipay Whether it is the mobile phone version.

Recommended learning: php video tutorial

The above is the detailed content of How to determine the browser type on mobile phone (JavaScript). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Latest Articles by Author
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template