Of Zen and Computing

Break Out of the DiggBar with JavaScript

Friday, April 3, 2009

Social news site Digg recently released the DiggBar — a frame that sits above any content linked with Digg’s new URL shortening service, containing various Digg functionality.

Some like the DiggBar, while others resent the idea of their site being enclosed in a Digg-branded frame. TechCrunch founding editor Michael Arrington considers it very useful. Tech writer John Gruber calls the DiggBar hyped B.S. and posted a special DiggBar-only version of Daring Fireball that flips off the service in no uncertain terms (language not safe for work). The sharp-witted Merlin Mann equates the DiggBar to an uninvited party guest.

Zap the DiggBar with JavaScript

Bloggers, web developers and anyone else with a website who feels that the DiggBar oversteps the bounds of being a good citizen of the Web can disable the DiggBar with the following JavaScript:

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

The window.self object reference points to the portion of the browser containing your site, while window.top refers to the topmost window (where DiggBar resides). If your site is loaded inside a frame such as DiggBar this comparison will fail and your site will be re-assigned to the topmost window, making the DiggBar history.

Categories: Code

Tags: , , , ,

Digg icon StumbleUpon icon del.icio.us icon Facebook icon

Other articles related to this page

© 2006-2009 OfZenAndComputing.com
E-mail Disclaimer | Terms of Service & Disclaimer | Sitemap

Subscription Options
Search Our Archive of How-To Articles and Blog Posts