Skip to content

Instantly share code, notes, and snippets.

@aprilandjan
Created April 19, 2017 03:16
Show Gist options
  • Save aprilandjan/325b30b25ab5fd9daf066747f727f56b to your computer and use it in GitHub Desktop.
Save aprilandjan/325b30b25ab5fd9daf066747f727f56b to your computer and use it in GitHub Desktop.
var userAgent = window.navigator.userAgent.toLowerCase()
var ua = {
isIOS: userAgent.match(/iphone|ipad|ipod/i),
isAndroid: userAgent.match(/android/i),
isWechat: userAgent.match(/micromessenger/i),
isWeibo: userAgent.match(/weibo/i),
isQQ: userAgent.match(/qq/i),
isMobile: userAgent.match(/iphone|ipad|ipod|android/i)
}
export default ua
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment