我有这个脚本来获取浏览器的语言并打开本地化的特定索引
var language = window.navigator.systemLanguage;
if (language == "it-IT" || language == "it-it" || language == "ita-IT" || language == "it-ITA" || language == "it" ||language == "IT" ||language == "ita" ||language == "italiano" || language == "italian")
{
location.href = "index_it.html";
}
else{
location.href = "index_esp.html";
}
index_esp.html
不幸的是,仅在 Internet Explorer 中有效,但在 Firefox 和 Chrome 中,意大利浏览器也始终打开
如何获得正确的语言字符串 ID?(如果这是问题的原因)