JSFiddle - React, Tailwind, and code Playground

by NicosKaralis

HTML

<span id="ipad" style="display: none">
    You are a happy owner of a brand new iPad
</span>
<span id="iphone" style="display: none">
    You are a happy owner of a brand new iPhone
</span>
<span id="noipad" style="display: none">
    Sorry, you do not have an iPad
</span>

JavaScript

//alert(navigator.userAgent)
if (navigator.userAgent.match(/iPad/i) != null) {
    $('#ipad').show();
    $('#noipad').hide();
    $('#iphone').hide();
    window.location = "http://www.google.com/";
}else if (navigator.userAgent.match(/iPhone/i) != null) {
    $('#iphone').show();
    $('#ipad').hide();
    $('#noipad').hide();
    window.location = "http://www.globo.com/";
}else {
    $('#noipad').show();
    $('#ipad').hide();
    $('#iphone').hide();
}