Posted By

damarev on 07/19/07


Tagged


Versions (?)

browser redirection


 / Published in: JavaScript
 

  1. var alerta = "navigator.language="+navigator.language + "\nnavigator.userLanguage="+navigator.userLanguage +"\nnavigator.browserLanguage="+navigator.browserLanguage
  2. //alert(alerta);
  3.  
  4. function getlanguage(){
  5. language=navigator.language;
  6. if(language){
  7. language=language.substring(0,2);
  8. }else{language="z";}
  9. switch (language){
  10. case "en" :
  11. //window.location="english.html";
  12. break;
  13. case "es" :
  14. window.location="spanish.html";
  15. break;
  16. case "de" :
  17. window.location="german.html";
  18. break;
  19. case "fr" :
  20. window.location="french.html";
  21. break;
  22. case "it" :
  23. window.location="italian.html";
  24. break;
  25. case "sv" :
  26. window.location="swedish.html";
  27. break;
  28. case "nl" :
  29. window.location="dutch.html";
  30. break;
  31. default :
  32. //alert();
  33. //window.location="english.html";
  34. }
  35. }
  36. getlanguage()

Report this snippet  

You need to login to post a comment.