|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Member
Iscritto dal: Apr 2005
Messaggi: 296
|
[PHP-ASP] Determinare in che lingua è il sistema operativo del client
I have to write a web page that determines the client OS language and then redirects the browser to the appropriate page (possibly in the same language).
Suppose the client browsers run on Windows NT/XP/2000/2003 Using client-side scripting, i can do it in this way: Codice:
<html> <body> <script language="vbscript"> For Each objOperatingSystem in GetObject( "winmgmts:").InstancesOf ("Win32_OperatingSystem") ' this cycle should be executed only once if objOperatingSystem.OSLanguage = 9 then 'go to English page location.href = "http://mypage.com/english.html" elseif objOperatingSystem.OSLanguage = 1041 then 'go to Japanese page location.href = "http://mypage.com/jap.html" ' etc... end if Next </script> </body> </html> I just want the page be opened without asking the user. I think that retrieving client OS from server side will solve the problem, but is there a way to do it? using PHP, for example.. thanks in advance |
![]() |
![]() |
![]() |
#2 |
Messaggi: n/a
|
I don't know if you can do something like this.
I think that maybe is a good idea make a sniffer about the country's IP Don't you think? P.S. Why did you write the title of the thread in italian and the body in english? ![]() Sorry for my english ![]() |
![]() |
![]() |
#3 | |
Senior Member
Iscritto dal: May 2006
Città: Salerno
Messaggi: 936
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#4 |
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Questa cosa è spesso risolvibile tramite server web...ad esempio Apache ha il modulo che redireziona il visitatore sulla pagine con la lingua giusta.
Ci sta che esista un isapi filter apposito anche per IIS. |
![]() |
![]() |
![]() |
#5 |
Member
Iscritto dal: Apr 2005
Messaggi: 296
|
certo che sono italiano
![]() solo che quel post l'avevo prima messo su un altro forum in inglese e ho fatto copia e incolla, non avevo voglia di tradurre ![]() comunque ho risolto, grazie.. per chi fosse interessato: per scoprire da lato server qual'è la lingua del client basta leggere l'header http ACCEPT-LANGUAGE che i browser mandano quando richiedono la pagina web Codice:
<?php $acceptLang = $_SERVER["HTTP_ACCEPT_LANGUAGE"]; /* fai il parsing della stringa ... che è nel formato specificato nel protocollo HTTP http://www.faqs.org/rfcs/rfc2616.html */ ?> Ultima modifica di GordonFreeman : 26-07-2007 alle 10:33. |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 02:47.