Is there anyway to detect OS language using javascript?

前端 未结 4 1333
深忆病人
深忆病人 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条回答
  •  Happy的楠姐
    2020-12-06 11:39

    You can use the user agent. However, it can be spoofed easily, it is not guaranteed to contain language information, and navigator.language and navigator.browserLanguage will probably be more reliable.

提交回复
热议问题