# Automatic Redirect Based on Browser Language

**URL:** <https://community.hubspot.com/t/automatic-redirect-based-on-browser-language/35050>\
**Category:** CMS Development\
**Tags:** local-development\
**Created:** [April 7, 2021, 7:40am UTC](https://community.hubspot.com/t/automatic-redirect-based-on-browser-language/35050 "2021-04-07T07:40:37Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [April 7, 2021, 4:58pm UTC](https://community.hubspot.com/t/automatic-redirect-based-on-browser-language/35050/3 "2021-04-07T16:58:17Z")

</div>

Hi @BrandonSeerene (sorry to jump in @Anton 😉). You could do this:

```lia-code-sample
const lang = navigator.language
if (lang.includes('de')) {
 window.location = 'https://www.example.com/de'
}

```

The navigator language code for German in Germany/Austria/Switzerland all include ‘de’ (e.g. de-CH for Swiss German) so you just test if the navigator language includes that substring or not; if it does, load your German site.

---

_[View the full topic](https://community.hubspot.com/t/automatic-redirect-based-on-browser-language/35050)._
