I've been searching for a way to redirect users to a website with their preferred browsing language.
The code seems simple enough.
The above works but when I go into my language options in both ie and firefox, and change my language preference, userLang still alerts to en-US. I want to stay away from ie only properties such as systemLanguage.
I can't really find to much documentation on the subject anyone have any info on this or an example I can view?
I thought changing my preferred language would change my userLang var. I notice that if I change my preferred lang google redirects me to a site with that lang I want to emulate that behavior with out having to use http header values.
The code seems simple enough.
Code:
var userLang = (navigator.language) ? navigator.language : navigator.browserLanguage;
The above works but when I go into my language options in both ie and firefox, and change my language preference, userLang still alerts to en-US. I want to stay away from ie only properties such as systemLanguage.
I can't really find to much documentation on the subject anyone have any info on this or an example I can view?
I thought changing my preferred language would change my userLang var. I notice that if I change my preferred lang google redirects me to a site with that lang I want to emulate that behavior with out having to use http header values.