Created
September 6, 2016 03:13
-
-
Save limi58/cad983256ba82902be1cd693fe4c0372 to your computer and use it in GitHub Desktop.
check phone system
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
function getSystem() { | |
const isWx = this.isWx() | |
const u = navigator.userAgent; | |
if(isWx && u.indexOf('Android') > -1){ | |
return 'aw' | |
} | |
if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) { | |
return 'a' | |
} else if (u.indexOf('iPhone') > -1) { | |
return 'i' | |
} else if (u.indexOf('Windows Phone') > -1) { | |
return 'w' | |
} | |
} | |
function isWx() { | |
return navigator.userAgent.indexOf('MicroMessenger') > -1 ? true : false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment