Open a multi-language website in the visitor's browser language

Hi guys,

is there a way to open a multi-language website made with Blocs in the visitor’s browser language?

Thanks.

I posted the answer to this some time ago. Link Below.

1 Like

Thanks for your reply?

Where should I put this code? Header, footer…?

Best to place it in the header.

I placed this code in the header but it doesn’t work…

<script type= "text/javascript">
var language = window.navigator.language;
  
if(language == "en-US" || language == "en-“gb || language == "en-CA"){
window.location.href = "www.noemilovesdavide.com";
}

else if(language == "it" || language == "it-ch"){
window.location.href = "www.noemilovesdavide.com/home-ita.html";
}     
</script>

I think you can use just “navigator.language”

Also you have a typo, should be “en-GB”

You can also simplify this down. Since you only have 2 languages, check if it’s Italian if not go to English.