August 14, 2003 | Category:

Permalinks And Data

There’s an old problem with permalinks: they have a tendency to end up not being permanent. You keep a record of articles (bookmarks/favourites) that you know you’ll want to refer back to later. When it comes time to actually use them, the links are broken for whatever reason and you’re left staring at a 404 screen. Not fun.

It’s happened to me once too many times, so I’m going to try to solve the problem for at least my site. My thinking is that servers are outwith the control of most people, even the owner of the site living on the server, thus making it the weakest link in the distribution chain. So, how do we remove reliance on servers to recall information?

The best answer is immediate addressing in the form of Data: URL‘s. For those who’ve never seen a data:url, it’s a way to store information (images, text, or pretty much anything else) as a link; that is, the link is the data, not just a pointer to it. It’s a great concept being used in various ways (not least as a way of beating DVD encryption).

When permalinks meet data:urls, we have a way of storing entries as links. That is, we have bookmarks that will never break.

Of course, this is not without it’s problems:

  1. Internet Explorer – Not unsurprisingly, IE does not support data: url’s and won’t do anytime soon. So, those users don’t get the added benefits unless they upgrade.
  2. Bandwidth – by providing the data on a page and as a link, bandwidth usage is effectively doubled. This is not good. To combat this, I only provide data: permalinks on individual item pages. You’ll have to click through to an entry to get the data permalink.
  3. Limited space – Although Mozilla and its derivatives offer data: urls of up to 2Gb, the recently added support in Opera is limited to 4kb. That’s not a lot of room for a full-on essay. Happily, though, it’s easily big enough for most entries around here. Those that are too long get automatically cut down to size and a real permalink added to the end, pointing to the full articale. This is very much a compromise, but one worth making.
  4. Unclosed Tags – Related to large essays getting cut down (above), permalinks on this site might have unclosed tags towards the end. This is entirely my fault. Eventually, I will work on a way to automatically close tags that are open, but until I do they’ll be broken. Sorry.

If you want to play with data: urls yourself, there are some good resources. Ian Hickson’s data: URI kitchen is the best place to generate them for experimentation. Or, if you’re feeling really fruity, there is Simon Willison’s self-contained data: URI kitchen; a reinvention of Ian’s kitchen as a data: uri (confusing yes, useless no).

Thanks to Ian Hickson for providing the numbers on URL lengths, and to Simon Willison for reworking the original kitchen and inadvertantly giving me a kick to get this done.