16 enero, 2010

Codigo en JavaScript para saber que Sistema Operativo usamos

function GetSO() {
var SO = '';
Datos = navigator.userAgent;
if(Datos.indexOf('IRIX') != -1)SO = 'Irix';
else if((Datos.indexOf('Win')!=-1) && (Datos.indexOf('98')!=-1))
SO = 'Windows 98';
else if((Datos.indexOf('Win')!=-1) && (Datos.indexOf('95')!=-1))
SO = 'Windows 95';
else if(navigator.appVersion.indexOf('16') != -1)
SO = 'Windows 3.1';
else if(Datos.indexOf('NT 5.1') != -1)
SO = 'Windows XP';
else if(Datos.indexOf('NT 5.2') != -1)
SO = 'Windows Server 2003';
else if(Datos.indexOf('NT 5') != -1)
SO = 'Windows 2000';
else if(Datos.indexOf('NT 6.1') != -1)
SO = 'Windows 7';
else if(Datos.indexOf('NT 6') != -1)
SO = 'Windows Vista';
else if(navigator.appVersion.indexOf('NT') != -1)
SO = 'Windows NT';
else if(navigator.appVersion.indexOf('SunOS') != -1)
SO = 'SunOS';
else if(navigator.appVersion.indexOf('Linux') != -1)
SO = 'Linux';
else if(Datos.indexOf('Mac') != -1)
SO = 'Macintosh';
else if(navigator.appName == 'WebTV Internet Terminal')
SO = 'WebTV';
else if(navigator.appVersion.indexOf('HP') != -1)
SO = 'HP-UX';
else
SO = 'SO Desconocido';
return SO;
}

No hay comentarios: