Smarter Links With jQuery: Catch404
Within time, links on our websites can become invalid as the URLs they point may not be existing any more.
Catch404 is a jQuery plugin which adds a layer between the web page and the link to detect this issue with the process:
- when a link is clicked, it sends a request to the page
- if a 404 message is returned, displays a modal box mentioning that the page does not exist. Else, redirects to the URL.
It has pros and cons like adding an extra request to links which ends up in a slower browsing experience but prevents redirecting readers to non-existing pages.
The plugin does not require any scripting language as the query is sent via Ajax to the Yahoo YQL (which is mostly the reason of the slower experience).