JSFiddle - React, Tailwind, and code Playground

by lark

JavaScript

// Create normalized xhr object
    function xhr() {
        // To stifile any exceptions
        try {
            // Detect native XMLHttpRequest object
            if('XMLHttpRequest' in window && XMLHttpRequest) {
                return new XMLHttpRequest();
            }
            // Detect IE ActiveX object
            if('ActiveXObject' in window && ActiveXObject) {
                return new ActiveXObject("Microsoft.XMLHTTP");
            }
        }
        // Swallow exceptions and return undefined
        catch(e) {}
    }