I despise broken links.

Most of the sites I read on a daily basis are littered with links to this site or that site.  Many of them are written quickly to get news stories out promptly and, as a result, are published with typos.

It's one thing when I catch a typo in body content - most of us can read English words if the characters are in any order - but a typo in a link can be catastrophic.

The other day, for example, a friend posted a link to Twitter. Twitter immediately tried to parse the link to auto-shorten it ... and broke the link in the process (apparently their tool doesn't like quotes in URLs):

Similar mistakes make blogs and news posts difficult to follow.  A simple entry error can turn an otherwise useful link (i.e. http://google.com) into a broken one that results in a 404 Not Found error (i.e http://mindsharestrategy.com/htpt://google.com).

Not checking for broken links can lead to a poor user experience.  WordPress is all about creating a great user experience, so I think it should do a certain amount of checking for authors to protect us from our own proofreading laziness.

An Alternative

I'm a big fan of optimistic UI feedback.  Essentially, you assume that whatever action the user invoked is successful and only display messages when things fail or when unexpected behavior occurs.

Rather than prompting the user with a JavaScript alert every time a blog post is saved, you sound the sirens when something goes wrong.  The user expects the post to save, so you save it, give some subtle feedback (like the "post saved" message at the top of the screen) and move on.

Background processes should be even more subtle.

My suggestion is that the insert/edit link dialog check in the background to see if the entered URL is valid.

Technical Details

When the URL field loses focus, the UI submits the URL back to WordPress via AJAX.  WordPress then does a quick header check on the URL using the HTTP API.  All we really need is the response headers from the server to make sure it's not a 404, any other response (200 OK or a 30X redirect) are fine.

If the link 404s, add some visual indication to the UI that the link might be bad.  If the link succeeds, and some indication that is passes.  For example, the two screenshots below show one way this feedback could be conveyed to the user:

Placing the mouse cursor over the indicator icon or the highlighted URL field would prompt the user to explain that the URL as typed returned an error and might be invalid.

This would in no way prevent the user from adding the link anyway. It's merely intended to be a quick check to help prevent broken links from making their way into the field.

What are your thoughts? Do you see any value in this feature? Do you think your customers would see any value?