Remys Dead Link Solution Chris Coyier
On this site, at the moment, I have a 🔀 random button in the header that takes you to a random blog post. The chances that the random blog post has links in it that are dead are way too high. As in, the URL no longer resolves, or goes somewhere entirely wrong now.
Perfect world, I have unlimited time, and I’m constantly editing blog posts and QAing the links. Hahahhahahahhahahha. No.
Remy has this same problem, and fixes it 🎵 with technology 🎵:
When a real user clicks on a link, it’s swapped out to be redirected through my own endpoint that checks if the URL is still OK, and if so permanently redirects the visitor, otherwise my endpoint checks the Web Archive for the URL and permanently redirects to that instead.
It’s done with progressive enchancement so the links aren’t touched at all if JavaScript doesn’t load. When it does, when you click an (external) link, it goes to a cloud-function instead which tries to fetch the URL. If a 200 response comes back, you get redirected to the original link. If any other response comes back (probably a dead link), it uses the Web Archive API to see if the site is in there somewhere and redirects to that if it can.
There is a 2-second timeout in place, so worst-case scenario, you’ve got that delay, then the delay to hit the API, then the delay in loading the archive site (which is understandably a bit slow).
I find all this super cool, and despite the delays, and totally worth it for dead URLs. But it does introduce some delay for otherwise normal working links which is a tough pill to swallow. I find it pretty abhorent that X delays links, even though those dinks are doing it just to be petty rather than for some useful purpose. Just don’t want to be hypocritical. Speed matters!
Still, I could see this implemented at different levels. Maybe the speed is a solveable problem. Like a browser extension? A WordPress plugin? The browser itself?
UPDATE: The Wayback Machine does have a browser extension. It’s got various functionality, but to connect it to what I was saying, I guess you’d land on a broken link, click the extension open, then click the thing that search that page in the Web Archive history and go there. Not particularly automated but a little useful.
Related
ncG1vNJzZmibmKe2tK%2FOsqCeql6jsrV7kWlpbGdhZXxyfY6rnKaxo2Kxpq3DZqOipptiwLC41K2gqKZf