Language Detection and Redirect URL

var language = window.navigator.language;
if(language == 'en-US'){
    window.location.href = "www.hasaluminyum.com/en"
}

This will work without Jquery. Here is a list where you can find the language codes.

http://www.metamodpro.com/browser-language-codes

My old code might not work anymore. Notice my old code has ‘en’ for english but my browser passed the value ‘en-US’

1 Like