Old web techniques

I often go around looking at the source for the websites I frequent. It’s not very interesting to most people, but I am not most people.

Something I’ve noticed a few times in the last couple of weeks is that sites are suddenly using an evolved form of a script I was very familiar with many years ago:

if(top.location != self) {
  top.location.replace(document.location.href);
}

That’s how it appears on Last.fm. Essentially the script checks to see if the page is contained within another page, and then takes the user to the page by itself if it is. This gets rid of page headings you sometimes see from sites like Digg and Facebook when you follow a link from there.

The script used to be used to make your own site break out of frames put there by sites like Geocities (R.I.P.) before domains and hosting were quite so affordable. Obviously now there are basically no sites on the Internet that use frames in the traditional sense (that’s a good thing), but the modern equivalent (iframes) are pretty much all over the place. They tend to be used for displaying external content rather than the layout of internal content, but the idea is mostly the same: multiple documents on one page.

I just find it somewhat interesting that “web 2.0” seems to be encountering the exact same things I really hated about web 1.0 all those years ago.

Patched Digg Digg WordPress plugin

I was adding a Digg button to the company blog using the Digg Digg plugin when I found an issue that meant that the post ID was lost by the time it reached Digg’s description page.

It seemed that the plugin wasn’t escaping the = symbol in the URL which caused Digg to not understand the query. I added the following code to the construstURL function in dd.class.php file:

$url = str_replace('=', "%3D", $url);

Everything went through correctly, and so if you’re having a similar issue then you might want to check that you’re properly escaping the URL you’re passing to Digg, especially if it has parameters.