0

I have the code to check if a webpage exists that is working perfectly fine, but I need to check if it exists many times a second. Would this code cache, or would it check every time?

var url = "urlhere"+"?noCachePlease="+(Math.random()*1000000);
var aa = setInterval(function() {
    var request = new XMLHttpRequest();  
    request.open('GET', url, true);
    request.onreadystatechange = function(){
        if (request.readyState === 4){
            if (request.status === 404) {  
                //Site DNE
            }  
        else { clearInterval(aa); }
        }
    };
    request.send();
}, 50);
//Afterwards

0 Answers0