How to get the browser language using JavaScript
JavascriptJavascript Problem Overview
> Possible Duplicate:
> JavaScript for detecting browser language preference
I want to detect the language of the browser that is entering my site, if it's En or Fr. So I can redirect to the En page or the other page.
Also, can I detect mobile language?
Javascript Solutions
Solution 1 - Javascript
Try this script to get your browser language
Cheers
Solution 2 - Javascript
The "JavaScript" way:
var lang = navigator.language || navigator.userLanguage; //no ?s necessary
Really you should be doing language detection on the server, but if it's absolutely necessary to know/use via JavaScript, it can be gotten.