detector de windows y explorer
Hola a tod@s!
Me gustaría saber como puedo detectar si el usuario tiene windows e internet explorer, y si es asi que se vaya a un archivo html, y sino, a otro.
Gracias.
Me gustaría saber como puedo detectar si el usuario tiene windows e internet explorer, y si es asi que se vaya a un archivo html, y sino, a otro.
Gracias.
Esta función te indica el sistema operativo:
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";
if (sAgnt.indexOf('98') != -1) OpSys = "Windows 98";
if (sAgnt.indexOf('95') != -1) OpSys = "Windows 95";
if (sAgnt.indexOf('NT 5.0') != -1) OpSys = "Windows 2000";
//Lo he añadido yo, se que salta si es XP, pero no se si tambien salta con algun otro SO.
if (sAgnt.indexOf('NT 5.1') != -1) OpSys = "Windows XP";
} else {
if (sAgnt.indexOf('IRIX') != -1) OpSys = "Irix";
if (sAgnt.indexOf('Mac') != -1) OpSys = "Macintosh";
if (navigator.appName=="WebTV Internet Terminal") OpSys="WebTV";
}
return OpSys;
}
function alertOS(){
alert(checkOS());
}
Para saber las caracteristicas del navegador:
Busca las propiedades objeto navigator
Por ejemplo:
if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
...
// lo que tu quieras
...
}
Suerte
rsalvadores
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";
if (sAgnt.indexOf('98') != -1) OpSys = "Windows 98";
if (sAgnt.indexOf('95') != -1) OpSys = "Windows 95";
if (sAgnt.indexOf('NT 5.0') != -1) OpSys = "Windows 2000";
//Lo he añadido yo, se que salta si es XP, pero no se si tambien salta con algun otro SO.
if (sAgnt.indexOf('NT 5.1') != -1) OpSys = "Windows XP";
} else {
if (sAgnt.indexOf('IRIX') != -1) OpSys = "Irix";
if (sAgnt.indexOf('Mac') != -1) OpSys = "Macintosh";
if (navigator.appName=="WebTV Internet Terminal") OpSys="WebTV";
}
return OpSys;
}
function alertOS(){
alert(checkOS());
}
Para saber las caracteristicas del navegador:
Busca las propiedades objeto navigator
Por ejemplo:
if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
...
// lo que tu quieras
...
}
Suerte
rsalvadores