JSFiddle - React, Tailwind, and code Playground

by mattias_jcb

JavaScript

function createXHR() {
    var xhr = new XMLHttpRequest();
    if ("withCredentials" in xhr) {
        return xhr;
    } else if (typeof XDomainRequest != "undefined") { // IE 8-9
        return new XDomainRequest();
    } else {
        return null;
    }
}

var xhr = createXHR();

if (!xhr) {
    document.write('CORS not supported');
    return;
} else {
    xhr.open("GET", "http://www.corsproxy.com/www.spatialreference.org/ref/epsg/2400/proj4/")
    xhr.onload = function() {
        document.write(xhr.responseText);
    };
    xhr.onerror = function() {
        document.write('Woops, there was an error making the request.');
    };
    xhr.send();
}