Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Operating System Detection

Status
Not open for further replies.

Kriekie

Technical User
Nov 21, 2004
10
ZA
Hi All!

I have a custom popup script that works fine with Windows XP Professional, but not with XP Home. I want to add a script that will detect wether the user is using XP Home or XP Professional and then redirect the user according to these variables. However, the only scripts I can find detects only if it is a Windows Operating System or a Mac Operating system, which is not sufficient. Any ideas how this can be done?

Thanx!
 

Check out the results of alerting the following in the browser on each OS:
Code:
alert(navigator.userAgent)
You can then use some string manipulation to make decisions (assuming that the two alerts are different in a consistent manner).

Cheers,
Jeff

 
No idea. Are you sure the OS is responsible for the differences, and not the software installed on it?

You might be able to detect which interpreter is powering the scripts, but not all interpreters support this! ;)

Code:
<script>
function getInfo(){
var engine = '';
   engine += ScriptEngine();
   engine += ' ' + ScriptEngineMajorVersion();
   engine += '.' + ScriptEngineMinorVersion();
   engine += '.' + ScriptEngineBuildVersion();
alert(engine);
}

window.onload = getInfo;
</script>

----------
Memoria mihi benigna erit qui eam perscribam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top