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

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

奋力向前
奋力向前forward
2021-07-06 13:20:372395browse

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))
}

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!

Statement:
This article is reproduced at:512pic.com. If there is any infringement, please contact admin@php.cn delete