javascript - HTTP_ACCEPT_LANGUAGE differs from navigator.language in Firefox in Linux -


i programming webpages in local apache 2 web server in linux, , use php auto-recognize browser language.

in webpage trying console.log() javascript language client has preferred , 2 different outputs:

  • javascript (console.log(navigator.language);) returns es-es
  • php (<?php echo $_server['http_accept_language'] ?>) returns en-us,en;q=0.5

in about:config, variable intl.accept_languages set es-es, es, en-us, en.

note: local language, want achive get, spanish (es-es).

for reason, firefox seems not configured in linux distro (linux mint 18.1), while have installed (firefox , firefox-locale-es).

if try chromium in same computer, php output es-es,es;q=0.8;q=0.6, correct.

if try firefox in other computer windows, or firefox android, php output correct: es-es,es;q=0.8;en-us,en;q=0.5.

why php output wrong in firefox linux , how solve it? in advance.


edit: these http headers (i crossed out authentication headers)

request:

get / http/1.1 host: localhost user-agent: mozilla/5.0 (x11; ubuntu; linux x86_64; rv:54.0) gecko/20100101 firefox/54.0 accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 accept-language: en-us,en;q=0.5 accept-encoding: gzip, deflate, br referer: https://localhost/ cookie: phpsessid=crucsit7is3r6hvnd88k6q2rn5 authorization: ######## connection: keep-alive upgrade-insecure-requests: 1 pragma: no-cache cache-control: no-cache 

response:

http/1.1 200 ok date: tue, 25 jul 2017 20:39:21 gmt server: apache/2.4.18 (ubuntu) authentication-info: ######## expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate pragma: no-cache vary: accept-encoding content-encoding: gzip content-length: 1301 keep-alive: timeout=5, max=100 connection: keep-alive content-type: text/html; charset=utf-8 

i found solution while trying sleep, because chrome did years ago.

thanks @pointy trying anyway

so if have problem, steps:

  1. enter in configuration panel in firefox (about:config in search bar).
  2. search intl.accept_languages variable.
  3. replace whatever have default value different language in format: xx-xx, xx, example de-de, de. important part variable has change state "default" "user-modified" one.
  4. replace again value correct value: own values + default firefox values, es-es, es, en-us, en (replace es-es, es part values, example, fr-fr, fr, en-us, en).
  5. the http headers should have been reset configuration.

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -