SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2006
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Detecting local browser language settings

    Is there an easy way to detect the local language setting of a client
    browser?

    I would like to determine if the users browser is set to
    English, French, Italian or German language and display a message in the appropriate language but don't want to redirect user.

    Many thanks.

  2. #2
    SitePoint Evangelist hexburner's Avatar
    Join Date
    Jan 2007
    Location
    Belgium
    Posts
    591
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code JavaScript:
    function detectLanguage() {
        var language=(navigator["language"])?navigator["language"]:navigator["userLanguage"];
        alert(language);
    }
    FOR SALE: 1 set of morals, never used, will sell cheap


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •