title: Javascript redirection according to browser language
body: <p>I'm trying to send visitors that have browser language in English to an alternative site.
  I was able to find this code but it's not working:</p>
  
  <pre><code>&lt;script type="type/javascript"&gt;
  
  var language = navigator.browserLanguage;
  
  // alert(language);
  
  if (language.indexOf('en') &gt; -1) {
  document.location.href = 'http://en.socialpos.com.ar';
  } else {
  document.location.href = 'http://socialpos.com.ar';
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>I'm not even getting the alert :/<br />
  You can see it in <a href="http://socialpos.com.ar" rel="noreferrer">http://socialpos.com.ar</a></p>