我可以用JavaScript判断访问者是否'的语言环境遵循美国风格或世界其他地区's风格

Can I tell in JavaScript whether the visitor's locale follows the U.S style or the rest of the world's style?

本文关键字:风格 美国 地区 其他 世界 语言 判断 JavaScript 访问者 是否 我可以      更新时间:2023-09-26

是否有一种不引人注目的方法可以在JavaScript中判断访问者的区域设置是使用美国的年月日惯例还是世界其他地区的年月日公约?一个新的Date().toLocaleDateString()会把这个月放在正确的位置吗?

var language = window.navigator.userLanguage || window.navigator.language;

userIE的语言和其他一切的语言。en-US将为英语US。