How to kill that Digg Bar Frame

Digg recently introduced url shortener. This is not your standard url shortener where the shortener does a 302 forward. Digg shortener displays destination site in a frame. Which means the reader still stays on the Digg.

Most of the modern web analytics software will be able to record this visit, but it will problem in finding out the actual referrer.  Also standard traffic counters like alexa don't count this visit against your site.
So if you don't like to that DiggBar to be displayed on your blog.  You can add this one line code to your site. Add it to your webpage's head section.

<script type="text/javascript">
if (top !== self) top.location.href = self.location.href;

This code in fact doesn't allow anybody to display your content in their frame. Here is the demo url to check. It should work on all browsers.
Let me know if you have any other suggestions.

4 Responses

  1. Veera says:

    Really useful!

  2. chethan says:

    hey! the idea is good and the script works well!
    But, If You Have An Interesting Story And Ppl Need To Digg it..
    Then There is no chance the user diggs ur story…

    is there anyway that we could escape only the diggbar not the page?

  3. Pradeep CD says:

    Useful post… thanks

  1. April 6, 2009

    […] a bit fed up with companies like Facebook and Digg hijacking your posts inside their marketing frames? Well take a look at No Frames, a handy little WordPress plugin which removes these frames so you […]