# Check links

Functions to scan files and check that all links, HREFs, SRCs etc. as well as CSS links url("...") point to files which exist. The files which are scanned are the HTML and CSS text files (the ones which have any of the suffixes as specified by the suffix mapping). For this to be useful the files in your home page folders must be mirrors of the files at your servers. If you use this function as intended you never have to worry about dead links between your files anymore.

It works as follows: In every file scanned Alpha looks for all HREFs, SRCs, etc in the file. If you use the BASE element it will be noticed and used to determine to which URL a link is pointing. Everything inside comments is ignored.

Links to remote servers, which you don't have a home page folder for, are ignored. Also, if you have a home page folder for http://www.net/~myplace/, links like http://www.net/file.html are ignored, as they are outside your home page. For all other links, Alpha checks if the file exist.

If any invalid links are found, a window is opened where the lines look as follows:

    file.html               ; Line 8:   HREF="otherfile.html"
    file2.html              ; Line 23:  (anchor missing) HREF="file.html#anchor"
    folder:file3.html       ; Line 17:  (BASE used) SRC="pic/coolpic.gif"

In the first column is the name of the file with the link, including the path relative to the home page folder. In the second column is the line number where the invalid link is, and in the third column is the link itself. (anchor missing) means that the file exists but that the anchor is missing in the file. (BASE used) means that the file contains a BASE element. Use the up and down arrows to select a line in this window, and carriage return to open the file and select the line with the invalid link.

You can optionally check that the case of the links match the case of the file names on your disk. This can be useful as Mac file names are not case sensitive, while for example unix file names are. Therefore a link can work on your Mac but not work on a unix machine. In the preferences dialog you can tell Alpha to make a case sensitive link checking. This is slower and therefore not done by default.

Limitation:

Alpha only searches for strings like HREF="file" without checking that they are inside a tag. This means that Alpha could find links, which actually are not links. This should only be a problem in documents about HTML.

### Fixing a broken link

You can fix broken links by selecting a new one. To do this

- Select the line with the link you want to fix in the list of invalid links.
- Hit option-return. You can now select a new file from a file dialog.
- The link is now changed in your HTML document and the link is removed from the list of invalid links.

When the broken link contains an anchor "file.html#anchor", Alpha checks if the new file contains that anchor. If it does, #anchor is added to the new link, otherwise not.

Fixing a link works as long as you don't make any other changes to the file first. Then Alpha may not find the line with the link to fix.

Check Window
Checks links in current window.

Check Home Page
Check links in all html files in a home page folder and its sub folders.

Check Folder
To check links in all files in one folder. You can optionally check the subfolders.

Check File
To check links in a single file.

Check Remote Links
To check remote links in the current window using Big Brother. Big Brother 1.2 or later is required to use this function. A list of all remote links in the current window is sent to Big Brother. Big Brother checks the links and sends the result back to Alpha, which displays the result in a window. If a page has moved to a new location the link in your HTML window is automatically updated. Don't make any other changes to the file while checking remote links, because then Alpha may not find the line with the link to update.

Use Big Brother
Marks this menu item to indicate that link checks will be done with Big Brother instead of Alpha. If this menu item is checked, files and folders will be sent to Big Brother when you check links.

Some settings are temporarily changed in Big Brother, when you send a file or folder to it. These are

- The URL mapping of your home page folders.
- If subfolders should be searched or not.
- If case sensitive link checking should be done.
- Optionally you can tell Big Brother if it should ignore remote or local links. This is done in the preferences dialog. By default Big Brother's settings for this are used.

Big Brother is a shareware program by François Pottier, Francois.Pottier@inria.fr. You can get Big Brother from his home page.

The big advantage with Big Brother is that it can check all your remote links. It checks local links on your hard disk with about the same speed as Alpha, but Big Brother can run in the background while you do other things.

Other differences:

- Big Brother understands all HTML 3.2 links, but not things like <FRAME SRC="url">
- Alpha only searches for strings like HREF="url" and don't check that they are inside a tag, like <A HREF="url">. Big Brother does that.
- Big Brother doesn't check anchors.
- Big Brother doesn't check CSS links.

This comparison was done with Big Brother 1.2, and may of course not apply to later versions.