1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

detect browser language : javaScript

Discussion in 'JavaScript' started by dharyl, Jan 2, 2008.

  1. #1
    hi guys,:)

    I had problem in detecting the users' preferred browser language.

    i found out that navigator object properties only detects system related language. the .userLanguage detects local language of the user's pc,or the one used in the task bar,and being set via ControlPanel>Regional&LanguageOptions, then the .systemLanguage detects the OS language, then the .browserLanguage detects the default browser language of the system. so none of these stuffs would help me.

    what I need is to detect the user's preferred browser language that is being set via Tools>InternetOptions

    Is there any way to do that using Javascript?

    Hope somebody out there could help me. :rolleyes:


    thanks a lot,:D

    dharyl

    SEMrush
     
    dharyl, Jan 2, 2008 IP
    SEMrush
  2. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The reason nobody replied to your first thread was most probably because nobody has enough knowledge on the subject and nobody was willing to do research.

    Making a new thread is not the right way to go.
     
    MMJ, Jan 3, 2008 IP
  3. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,427
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Try with this:
    
      var l_lang;
      if (navigator.userLanguage) // Explorer
        l_lang = navigator.userLanguage;
      else if (navigator.language) // FF
        l_lang = navigator.language;
      else
        l_lang = "en";
    
    Code (markup):
     
    ajsa52, Jan 5, 2008 IP
  4. Lost Soul

    Lost Soul Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Working flawlessly ;)
     
    Lost Soul, Jan 5, 2008 IP