Created
August 9, 2016 08:41
-
-
Save loethen/c528482b004408c66650fd80abaaf6c1 to your computer and use it in GitHub Desktop.
检查微信浏览器版本号,安卓还是iphone, 是否是微信浏览器
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 检查微信浏览器版本号 | |
const browserVersion = Number(/micromessenger\/(\d)/i.exec(navigator.userAgent)[1]) //return 4 or 5 or 6 ... | |
// 检查浏览器平台 | |
const platform = /android/i.test(navigator.userAgent) ? 'android' : 'ios' // return android or ios | |
// 检查是否是微信浏览器 | |
const isWxBrowser = /micromessenger/i.test(navigator.userAgent) //return true or false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment