Last active
December 14, 2019 09:15
-
-
Save JiangWeixian/9b38f90778fc47886fd5ccd3f4c4bc65 to your computer and use it in GitHub Desktop.
判断是否在微信/device?
This file contains hidden or 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
var isWeixin = () => { | |
var ua = navigator.userAgent.toLowerCase() | |
return ua.match(/MicroMessenger/i)?.[0] === 'micromessenger' | |
} | |
// ios | |
navigator.userAgent.match(/(iPhone|iPod|iPad);?/i) | |
// android | |
navigator.userAgent.match(/android/i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
?.[0]
是ts
语法