12345678910111213141516 |
- const u = navigator.userAgent
- export const platform = {
- ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),
- android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
- iPhone: u.indexOf('iPhone') > -1,
- iPad: u.indexOf('iPad') > -1,
- isWeixin: u.toLowerCase().indexOf('micromessenger') !== -1,
- isAlipay: u.toLowerCase().indexOf('alipay') !== -1,
- uCBrowser: u.indexOf('UCBrowser') > -1,
- isChrome: u.indexOf('Chrome') !== -1,
- isBaidu: !!navigator.userAgent.match(/Baidu/i),
- isSafari: /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent),
- u: u,
- isSinaWeiBo: u.toLowerCase().indexOf('weibo') !== -1
- }
|