GordonFreeman
25-07-2007, 17:35
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:
<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>
The problem with the client-side approach is that IE will ask the user if he wants to execute the page or not, because it will detect active content within the script (the GetObject( ) call i guess).
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
Suppose the client browsers run on Windows NT/XP/2000/2003
Using client-side scripting, i can do it in this way:
<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>
The problem with the client-side approach is that IE will ask the user if he wants to execute the page or not, because it will detect active content within the script (the GetObject( ) call i guess).
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