Using XMLHttpRequest to check links on page load

Your browser can't handle XMLHttpRequest. This will only work in IE 5/6, Mozilla, Firefox, Safari and Opera 8. This page is still accessible though. The links just aren't checked.

The next list has some links to websites.

check.php source (horrible proof of concept, please improve ;)


header('Content-Type: text/plain;charset=utf-8');
$status = (@gethostbyname($_GET['uri']) ? 'okay' : 'broken');

?>document.getElementsByTagName('a')[<?php echo $_GET['link']; ?>].className = '<?php echo $status; ?>';

if (<?php echo $_GET['link']; ?> < (linksMax - 1)) {
 checkLink(<?php echo $_GET['link']; ?> + 1);

Home - More stuff