Setting a fallback on Links


When I was writing one of my previous entries about my experience of the InSites tour, I made the word “InSites” link to the lovely website that was used to promote the tour and sell the tickets. There is obvious advantages to doing this, as it makes it easy for readers to check out what the entry is referring to, but there is also a potential risk/problem with linking to sources that you can’t control. Normally when you link to a popular site you can be somewhat assured that it will remain active, but with a site like the Insites one, which existed only to promote an event that is now in the past, there is no reason for the site to remain online, and while at the time of writing it is still online, it is reasonable to expect it to be taken down soon.

So that will leave all my links to the site pointing to a domain that it no longer being used. What I would like to do is be able to set a fallback in the <a> tag that would test to see if the website was up and if not it would resort to an action of my choice, e.g. loading a picture of how the website used to look, which would still be beneficial.

In code terms I would expect it to be similar to the placeholder text introduced into HTML5 forms:

<a href="" fallback="images/insites_tour_img.png">Insites Tour Link</a>

Obviously the catch might be if the site is still up but redirecting to a 404 page, or a holding page, as then the fallback would not work unless there is a way to check if the domain has a redirection script on it before it loads? (If there are any web wizards reading this who know if this is possible, please leave a comment below).

Not link from Zelda, silly!
These are not the Links you're looking for!

The thing I like about this concept of being able to set a fallback, is that it lets the author remain in some sort of control on what they’re linking to on their blog, and it will result in a lot of links remaining unbroken. To use a term coined by the great web mystro himself (Dan Cederholm) it will help make the web become “bullet-proof”.