I hope you will be able to help me with my problem. I have 3 languages on my static html site. I would like to redirect a user based on their browser language settings.
This is my code:
var lang = navigator.language;
if (lang == 'pl'){
document.location.href = 'index_pl.html';
}
else if (lang == 'fr'){
document.location.href = 'index_fr.html';
}
else {
document.location.href = 'index.html';
}
alert(lang);
The problem is every time user will enter the website this script keeps refreshing/redirect a site. My question is how to check the user browser once and then redirect user to a dedicated webpage.
Thanks in advance.