Link Checker

linkchecker.user.js - install as Greasemonkey User Script.
NOTE: don't forget to activate the script for your pages by editing the Included Pages from Greasemonkey's menu!
You can test the script on the Linkchecker testpage.

Summary: use this script to visually inspect web pages after you edit links, or to quickly find external links suffering from link rot.

This Greasemonkey User Script spiders all links on the current web page and colors them according to the availability of the resource, from green for completely OK, to red for any serious error (not found, forbidden etc).

Installation

You can either open the script linkchecker.user.js in Firefox and click the "Install User Script" Button, or right-click the link and select "Install User Script" from the context menu. If you're not seeing these options, you might need to install Greasemonkey first.

The script is by default enabled only for pages called "testpage", you have to edit either the include directive from the script, or add included pages from Greasemonkey's intweface.

Example:

// @include        *testpage*
Change this into something like:
// @include        http://www.example.com/*
// @include        http://www.check-also.com/these-pages/*

Using the linkchecker

The script puts a greenish-colored button in the top right position of the enabled web pages. This button is labeled "Check links".

Clicking this button starts the process. Depending on the number links on the page, this process may take some time. The current status is displayed in the button label "Spidering (# of links to go)...".

You can pause the spidering process by clicking the button another time, and then resume where the script was paused.

Script output

Initially, the script finds all links on the current page and resets their color to dark blue on a white bkackground. Images are replaced by their ALT text or [img]. Then the un-testable links are excluded (marked with a silver background). Finally, the script iterates over all remaining links and sets their color and tool-tip (title) according to the test results.

After the script completes, the button displays the number of bad links found and becomes disabled. You then can visually hunt for link colors on the page.

Limitations and Warnings

Impact

This script can cause an increased load on the hosting web-server(s). For every link, a HEAD request is issued, which somewhat limits the amount of data transferred compared to real page spidering. The script uses a "spider queue" with a maximum number of MAXREQ simultaneous page requests; feedback of the queue size is displayed during runtime.
Please do not over-use this script, more than one run in a couple of days doesn't make sense much anyway. And remember: Cool URIs don't change.

If the script doesn't start spidering, but instead apperas to be waiting with "Initializing..." forever, you may check if you have the NoScript extension enabled, and if so, enable scripts for the current page at least temporarily. Spidering will then take off immediately.

Discussion

You can leave comments and discussions on my blog: Firefox based link checker.

Changelog


Version 1.01
    - fixed annoying typo
    - more friendly color scheme

Version 1.00
    - initial release

$Id: Linkchecker.html 11 2006-05-30 12:52:00Z joe $

About Greasemonkey

Greasemonkey is a Firefox extension, which can change web pages by applying cleverly crafted user scripts after they are loaded in the browser.

Tip! Greasemonkey Hacks by Mark Pilgim.

More Greasemonkey User Scripts

For more, and a couple of Greasemonkey resources, see Greasemonkey User Scripts.