JSFiddle - React, Tailwind, and code Playground

by Fabian Allel

JavaScript

//variable para detectar si es movil el dispositivo y cual es
var isMobile = {
    Android: function() {
        return navigator.userAgent.match(/Android/i);
    },
    BlackBerry: function() {
        return navigator.userAgent.match(/BlackBerry/i);
    },
    iOS: function() {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    },
    Opera: function() {
        return navigator.userAgent.match(/Opera Mini/i);
    },
    Windows: function() {
        return navigator.userAgent.match(/IEMobile/i);
    },
    alguno: function() {
        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
    }
};

if(isMobile.alguno()){
  if( isMobile.Android() ){
    	alert('android');
      	window.location.replace('https://www.android.com/intl/es_es/');
    }else if( isMobile.iOS() ){
        window.location.replace('http://www.apple.com/es/ios/');
        alert('ios');
    }  
}else{
    window.location.replace('http://www.microsoft.com/es-es/windows/windows-10-upgrade');
    alert('No Mobile');
}