The OP returns with the answer:
Well, I add this as the “Answer” if someone else comes across this (completely bizarre) behavior and lands here:
It turns out that my hosting provider was seriously aggressive caching from my WordPress site, which I did not know about.
At the time I posted my question, I didn’t think that being on WordPress mattered, but apparently it was.
This was mainly done as follows:
With pure cache
- Visitor 1 visits the site.
- php processes and displays the result as expected.
Visitor 1 serves the php output (based on its browser settings, etc.).
Visitor 2 visits the site. Visitor 2 sees the * version of visitor 1 of the site.
php is processed once and only once for Cache-clear.
This caching behavior meant that accessing cookies through php simply would not work correctly, but accessing them with Javascript would work.
( Important Note: It turned out that the above caching behavior is disabled for any user viewing the site when logging into Wordpress, and this is the usual behavior for WordPress Cache plugins. That's why I saw different behavior in Firefox than in other browsers, because I am actively logged in with Firefox. This might be useful information for someone out there.)
My decision:
Use Javascript to run an AJAX request into a .php file that processes the visitor’s language preferences and returns the result as a 2-character code (e.g. 'en' 'es' 'pt' 'de', etc.).
Using AJAX to call php allowed me to use php server access to the browser language settings, bypassing the super-agro caching of my host.
Hope this helps someone! And thanks to everyone who tried to help me with this.
source share