Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/05/2003, 10:40
Avatar de Kaopectate
Kaopectate
Colaborador
 
Fecha de Ingreso: diciembre-2001
Ubicación: Curaçao (Antillas Holandesas)
Mensajes: 3.179
Antigüedad: 23 años, 2 meses
Puntos: 38
Hola lizfranco.

Yo uso Win2000 y la propiedad navigator.userAgent identifica mi S.O. como Windows NT 5.0 por lo que si modificamos el script de la siguiente manera incluirá a Win2000:

Código PHP:
<html>
 <
head>
  <
script language="JavaScript">

   function 
checkOS(){
    var 
sAgnt navigator.userAgent;
    var 
OpSys 'other';
    var 
bWin = (sAgnt.indexOf('Win') != -1);
    if (
bWin){
     
OpSys "Windows NT or Windows 3.1 or ME or XP";
     if (
sAgnt.indexOf('98') != -1OpSys "Windows 98";
     if (
sAgnt.indexOf('95') != -1OpSys "Windows 95";
     if (
sAgnt.indexOf('NT 5.0') != -1OpSys "Windows 2000";
    } else {
     if (
sAgnt.indexOf('IRIX') != -1OpSys "Irix";
     if (
sAgnt.indexOf('Mac') != -1OpSys "Macintosh";
     if (
navigator.appName=="WebTV Internet Terminal"OpSys="WebTV";
    }
    return 
OpSys;
   }

   function 
alertOS(){
    
alert(checkOS());
   }

  
</script>
 </head>
 <body>
  <form name="frm">
   <input type="button" name="os" value="Probar función" onclick="alertOS()">
  </form>
 </body>
</html> 
Sería bueno sin embargo que probaras poner en un alert que te responde user.agent cuando lo corres en otro sistema operativo, de ese modo podríamos tener bases para ampliar la función.

Saludos.