Detect links to non-existent websites using JavaScript
<p>I'm attempting to detect broken links on a web page using JavaScript, and I've run into a problem. Is there any way to detect non-existent URLs using client-side JavaScript, as seen below?</p>

<pre><code>function URLExists(theURL){
    //return true if the URL actually exists, and return false if it does not exist
}

//test different URLs to see if they exist
alert(URLExists("https://www.google.com/")); //should print the message "true";

alert(URLExists("http://www.i-made-this-url-up-and-it-doesnt-exist.com/")); //should print the message "false";
</code></pre>
