JSFiddle - React, Tailwind, and code Playground

by marcolino

HTML

<html>
    <head>
    <script>

var connection, connectionSpeed, htmlNode, htmlClass;

// create a custom object if navigator.connection isn't available  
connection = navigator.connection || {
    'type': '0'
};

// set connectionSpeed
switch (connection.type) {
case connection.CELL_3G:
    // 3G
    connectionSpeed = 'mediumbandwidth';
    break;
case connection.CELL_2G:
    // 2G
    connectionSpeed = 'lowbandwidth';
    break;
default:
    // WIFI, ETHERNET, UNKNOWN
    connectionSpeed = 'highbandwidth';
}

alert(connectionSpeed);

</script>
     </head>
    <body>
    </body>
</html>