js 브라우저가 사용하는 언어 예시 코드 판단

1251 단어
 
  
<br>var language = navigator.browserLanguage?navigator.browserLanguage:navigator.language; <br>alert(language); <br>if (language.indexOf('en') > -1) document.location.href = 'english.htm'; <br>else if (language.indexOf('nl') > -1) document.location.href = 'dutch.htm'; <br>else if (language.indexOf('fr') > -1) document.location.href = 'french.htm'; <br>else if (language.indexOf('de') > -1) document.location.href = 'german.htm'; <br>else if (language.indexOf('ja') > -1) document.location.href = 'japanese.htm'; <br>else if (language.indexOf('it') > -1) document.location.href = 'italian.htm'; <br>else if (language.indexOf('pt') > -1) document.location.href = 'portuguese.htm'; <br>else if (language.indexOf('es') > -1) document.location.href = 'Spanish.htm'; <br>else if (language.indexOf('sv') > -1) document.location.href = 'swedish.htm'; <br>else if (language.indexOf('zh') > -1) document.location.href = 'chinese.htm'; <br>else <br>document.location.href = 'english.htm'; <br>

좋은 웹페이지 즐겨찾기