When Digg rolled out its new Diggbar feature a toolbar that displays the content of a site inside a browser frameset not everyone was pleased. Many of the web’s old hands cried foul, claiming the toolbar merely framed other websites.
The practice of presenting another site’s content within a frame served from your website has long been hated by web purists, and with good reason: It’s evil.
When the Diggbar first launched, Daring Fireball publisher John Gruber wrote, “When you call it ‘framing someone else’s site,’ everyone agrees it’s bullshit…. When you call it ‘The Diggbar,’ it’s Web 3.5 Awesome.”
Here’s the problem: If your site ends up on Digg, visitors using the Diggbar will visit your URL just the shortened Digg URL. If they bookmark the page, they’ll be forever visiting Digg, not your site. To make matters worse, Digg is serving ads through the Diggbar, which means your content is being framed and layered with ads. Meanwhile, Digg walks away with the money. Three Dog Media has a detailed explanation.
Digg is effectively making any links from the Diggbar useless to anyone besides Digg, and the results are evil of the highest order: It steals traffic, obfuscates URLs, pockets a profit and breaks the most basic element of the web: the URL.
For his part, Gruber quickly put together a bit of code to short-circuit the Diggbar. The result is a three-line snippet of PHP that checks to see if the referring URL is from the Diggbar. If it is, Daring Fireball displays its own private message for Digg readers.
UPDATE: Engadget is blocking it, too.
Not using PHP on your site? Not to worry, the basic principle is the same regardless of the language. You just need to inspect the referring URL, match it against a regular expression (see Gruber’s regex for a starting point) and then decide what to do: Output a message, redirect to a goatse image … the sky’s the limit.