mercredi 16 janvier 2019

If statement isn't working during detecting the language to redirect the page

Code skips the if statement.

I've searched for a while now for the answer but couldn't find a solution, and since the similar questions are marked as duplicate I wanted to say these first. So here is the code:

    <script type="text/javascript">
    function loadDocC1() {
    var userLang = navigator.language || navigator.userLanguage; 
    var lang = ("en-US");
    if (lang=userLang){
    window.location.replace("http://karabatak.info");
    }else {window.location.replace("http://kontrabandapart.info");}
    }
    </script>

code chooses one direction to go (either one site or other) regardless of variables.

Aucun commentaire:

Enregistrer un commentaire