javascript 获取操作系统语言

javascript获取方式:

<script>   
  var s = navigator.systemLanguage;   
  switch(s){   
  case   "zh-cn":   
     document.location.href = 'http://www.google.cn';
  break;   
  case   "zh-tw": 
  document.location.href = 'http://www.google.com.tw';
  case   "zh-hk":  
  document.location.href = 'http://www.google.com.hk';
  break;   
  default:   
  if(s.split("-")[0]=="en"){   
     document.location.href = 'http://www.google.com';  
  }else{   
     document.location.href = 'http://www.google.com';    
  }   
  }   
  </script>

posted @ 2012-08-27 11:38  沐雪架构师  阅读(1005)  评论(0编辑  收藏  举报