Last active
January 3, 2016 02:48
-
-
Save xuanfeng/8397576 to your computer and use it in GitHub Desktop.
getSystemInfo: 获取系统信息函数
This file contains 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
// get system info | |
var getOSInfo = function () { | |
var ver = navigator.userAgent; | |
var OS = navigator.platform; | |
if(OS == "Win32" || OS == "Windows") { | |
return 'Windows'; | |
} else if(OS == "Mac68K" || OS == "MacPPC" || OS == "Macintosh" || OS == "MacIntel") { | |
return "Mac"; | |
} else if(OS == "X11") { | |
return "Unix"; | |
} else if(String(OS).indexOf("Linux") > -1) { | |
return "Linux"; | |
} else { | |
return "Unknow"; | |
} | |
}; | |
// get screen width | |
var getWindowInfo = function () { | |
return { | |
width : function () {return $(window).width();}, | |
height : function () {return $(window).height();} | |
} | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment