Skip to content

Instantly share code, notes, and snippets.

@xuanfeng
Last active January 3, 2016 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xuanfeng/8397576 to your computer and use it in GitHub Desktop.
Save xuanfeng/8397576 to your computer and use it in GitHub Desktop.
getSystemInfo: 获取系统信息函数
// 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