function getDeviceOS() {
var os = navigator.userAgent;
var ua = navigator.userAgent;
if (ua.match(/Win(dows )?NT 6\.0/)) {
os = "Windows Vista";
} else if (ua.match(/Win(dows )?(NT 5\.1|XP)/)) {
os = "Windows XP";
} else {
if ((ua.indexOf("Windows NT 5.1") != -1) || (ua.indexOf("Windows XP") != -1)) {
os = "Windows XP";
} else if ((ua.indexOf("Windows NT 7.0") != -1) || (ua.indexOf("Windows NT 6.1") != -1)) {
os = "Windows 7";
} else if ((ua.indexOf("Windows NT 8.0") != -1) || (ua.indexOf("Windows NT 6.2") != -1)) {
os = "Windows 8";
} else if ((ua.indexOf("Windows NT 8.1") != -1) || (ua.indexOf("Windows NT 6.3") != -1)) {
os = "Windows 8.1";
} else if ((ua.indexOf("Windows NT 10.0") != -1) || (ua.indexOf("Windows NT 6.4") != -1)) {
os = "Windows 10";
} else if ((ua.indexOf("iPad") != -1) || (ua.indexOf("iPhone") != -1) || (ua.indexOf("iPod") != -1)) {
os = "Apple iOS";
} else if (ua.indexOf("Android") != -1) {
os = "Android OS";
} else if (ua.match(/Win(dows )?NT( 4\.0)?/)) {
os = "Windows NT";
} else if (ua.match(/Mac|PPC/)) {
os = "Mac OS";
} else if (ua.match(/Linux/)) {
os = "Linux";
} else if (ua.match(/(Free|Net|Open)BSD/)) {
os = RegExp.$1 + "BSD";
} else if (ua.match(/SunOS/)) {
os = "Solaris";
}
}
if (os.indexOf("Windows") != -1) {
if (navigator.userAgent.indexOf('WOW64') > -1 || navigator.userAgent.indexOf('Win64') > -1) {
os += ' 64bit';
} else {
os += ' 32bit';
}
}
return os;
};
'Language > JS,JQuery' 카테고리의 다른 글
[JS/JQuery] 비밀번호 생성규칙 검사 함수 (0) | 2021.11.14 |
---|---|
[jui] xtable grid filter (0) | 2021.02.01 |
[JS/JQuery] 개발하면서 만든 공통 함수들 (0) | 2020.11.19 |
[Bootstrap] modal 리사이징, 이동, 전체화면 (0) | 2020.11.19 |
[JavaScript] 클로저(Closure) (0) | 2020.11.13 |