简体   繁体   中英

When will navigator.language different to navigator.languages[0]?

I am studing browser fingerprint. The js worked in app's webview will detect whether users lied on language by get the result of navigator.language.substr(0,2) == navigator.languages[0].substr(0,2) .

We found there are about 3% users lied on language( navigator.language.substr(0,2) != navigator.languages[0].substr(0,2) ). By useragent, we found those mobile devices are:

  • some HUAWEI mobile phone(with Android 5.1, Android 6.0, Android 7.0, Android 8.0.0 ...)
  • some iPhone(with OS 9_1, OS 4_3_2, OS 5_1_1, OS 5_0 ...)
  • ...

Does those users lied on language? Is there any device's or browser's reason will result in navigator.language.substr(0,2) != navigator.languages[0].substr(0,2) ?

Please see the browser compatibility information . There it says:

In Chrome, navigator.language is the language of the browser UI, and is not guaranteed to be equal to navigator.languages[0] .

In Firefox, the navigator.languages property's value is taken from the intl.accept_languages preference.

It also says Safari is fully compatible, but perhaps older versions aren't?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM