JSFiddle - React, Tailwind, and code Playground

by digitarald

JavaScript

var checkHtmlSupport = function () {
    var v = document.createElement('video');
    return v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"') || '[empty]';
}
var checkHtmlSupportLax = function () {
    var v = document.createElement('video');
    return v.canPlayType('video/mp4') || '[empty]';
}
var isSupportedHTMLDevice = function (pUAString) {
    var types = ["iPad", "iPhone", "iPod", "android", "Silk"];
    var numTypes = types.length;
    var uaString = navigator.userAgent;
    for (var i = 0; i < numTypes; i++) {
        if (uaString.match(new RegExp(types[i], "i"))) {
            return true;
        }
    }
    return false;
}
var isSupportedHTMLDeviceFixed = function (pUAString) {
    var types = ["iPad", "iPhone", "iPod", "android", "Silk", "Firefox"];
    var numTypes = types.length;
    var uaString = navigator.userAgent;
    for (var i = 0; i < numTypes; i++) {
        if (uaString.match(new RegExp(types[i], "i"))) {
            return true;
        }
    }
    return false;
}
document.body.appendChild(document.createTextNode(checkHtmlSupport() + ', '));
document.body.appendChild(document.createTextNode(checkHtmlSupportLax() + ', '));
document.body.appendChild(document.createTextNode(isSupportedHTMLDevice() + ', '));
document.body.appendChild(document.createTextNode(isSupportedHTMLDeviceFixed() + ', '));