JSFiddle - React, Tailwind, and code Playground

by keif

JavaScript

function UrlExists(url) {
    var http = new XMLHttpRequest();
    http.open('HEAD', url, false);
    http.send();
    return http.status!=404;
}

var x = [
    'google.com',
    'some.site'
    ];
$.each(x, function(i, url) {
    $.ajax({
        type: "HEAD",
        async: true,
        url: url,
        error: function(message,text,response) {
            return false;
        },
        success: function(message,text,response){
            return true;
        }
    });
});