All-Encompassing Trip, by Guillermo Esteves

How to get rid of the DiggBar on Tumblr

I’ll let someone else explain why the DiggBar sucks, or why it doesn’t, but if you want to block it (and others, like Facebook’s) on your Tumblr blog, simply add this slightly modified frame-busting JavaScript to your theme:

<script type="text/javascript">
if ((top !== self) &&
    (document.referrer != 'http://www.tumblr.com/customize')) {
    top.location.replace(self.location.href);
}
</script>

The second condition of the if is important because without it, the script will break Tumblr’s “customize” page, and you won’t be able to modify your theme again.

This might not help with whatever side effects the DiggBar may cause on your PageRank, but at least it’ll stop your site from looking like this in the future.

Update: If you only want to block the DiggBar, use this instead:

<script type="text/javascript">
if ((top !== self) &&
    (document.referrer.match(/http:\/\/digg.com\/\w{1,8}\/*(\?.*)?/))) {
    top.location.replace(self.location.href);
}
</script>

Another update: Faruk Ateş says that using top.location.replace prevents the Back button from being broken. I updated the code to reflect that.

Notes

  1. klaatu reblogged this from hacks
  2. halostatue reblogged this from guillee and added:
    saved for my own reference when I update my
  3. laidbare reblogged this from inky and added:
    I do not like DiggBar.
  4. beingrandom reblogged this from hacks
  5. khanhtoan reblogged this from xoai
  6. bandit reblogged this from matthewb
  7. xoai reblogged this from hacks
  8. eagereyes reblogged this from guillee and added:
    It’s not just tumblr,...every webpage. I just added it...all...
  9. chartier reblogged this from hacks and added:
    A simple way to disable Digg’s traffic- and mindshare-stealing new DiggBar on Tumblr blogs.
  10. hacks reblogged this from matthewb
  11. xla reblogged this from matthewb
  12. mattschwarz reblogged this from matthewb
  13. sparo reblogged this from matthewb
  14. matthewb reblogged this from inky and added:
    Guillermo Esteves posted a JavaScript fix to disable use of the Diggbar on Tumblr sites. Below is a
  15. inky reblogged this from guillee and added:
    framekiller that won’t...‘customize’ page.
  16. guillee posted this