Is there anyway to detect OS language using javascript?

前端 未结 4 1341
深忆病人
深忆病人 2020-12-06 11:05

I need to detect OS language using javascript so I can view my page depending on the language.

I know that we can detect the browser language but that is not enough

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-06 11:31

    One thing for everyone here to consider, not all users know how to set their browser language preferences. So if you're making a site you WANT people to see, it's your problem if they land on it in a different language than one they're comfortable with, as it increases the change they will leave. A lot of it depends on the demographic you're targeting, but for a web page I think it's good to detect the system language IF you can at least, then then fall back on the browser language if you can't. It's more likely to be accurate.

提交回复
热议问题