获取客户端操作系统类型

时间:2013-08-17 12:10:01  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:sp;                                                           &nb...
  正文:

获取客户端操作系统类型
function detectos(){
  var suseragent = navigator.useragent;
  var iswin = (navigator.platform == "win32") || (navigator.platform == "windows");                                                                      
  var ismac = (navigator.platform == "mac68k") || (navigator.platform == "macppc") || (navigator.platform == "macintosh");
  if(ismac) return "mac";
  var isunix = (navigator.platform == "x11") && !iswin && !ismac;
  if(isunix) return "unix";
  var islinux = (string(navigator.platform).indexof("linux") > -1);
  if(islinux) return "linux";
  if(iswin){
      var iswin2k = suseragent.indexof("windows nt 5.0") > -1 || suseragent.indexof("Windows 2000") > -1;
      if(iswin2k) return "win2000";
      var iswinxp = suseragent.indexof("windows nt 5.1") > -1 || suseragent.indexof("Windows XP") > -1;
      if(iswinxp) return "winxp";
      var iswin2003 = suseragent.indexof("windows nt 5.2") > -1 || suseragent.indexof("Windows 2003") > -1;
      if(iswin2003) return "win2003";
  }
  return "other";
}


获取客户端操作系统类型》由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/JavaScript/25639.html


关于《获取客户端操作系统类型》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td