www.webdeveloper.com
Results 1 to 6 of 6

Thread: Capture language of users browser?

  1. #1
    Join Date
    Jan 2010
    Location
    Belgium
    Posts
    319

    Capture language of users browser?

    Hi,

    Is it possible to capture the language of a users web browser with JavaScript? If not, is it possible with PHP or Node?

    Thanks!

    Christophe

  2. #2
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    Not sure if you can do it with JavaScript, or not. But PHP can with phpinfo(). If you click this link, you'll see an example of everything that phpinfo() gives. Scroll down to HTTP_ACCEPT_LANGUAGE to see that it works in US English and (I believe) German.

  3. #3
    Join Date
    Aug 2006
    Posts
    1,943
    With PHP, its in $_SERVER['HTTP_ACCEPT_LANGUAGE']

    Dave

  4. #4
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    Quote Originally Posted by Christophe27 View Post
    Hi,

    Is it possible to capture the language of a users web browser with JavaScript?
    Code:
    var bLang = ( navigator.userLanguage || navigator.language ).substring( 0, 2 );

  5. #5
    Join Date
    Oct 2010
    Location
    Versailles, France
    Posts
    1,273
    It's possible to determine the time zone (if the user is on time) with this jTimeZoneDetect script (See this demo page)... But time zones are not country nor Languages !

  6. #6
    Join Date
    Jan 2012
    Posts
    15
    navigator object has a language of the browser. You can see all the attributes that has navigator using operator in: for(attr in navigator)
    http://web-design-lessons.com/articl...er%20Detection

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles