How to block the DiggBar
daringfireball.net
daringfireball.net
<script language="JavaScript" type="text/javascript">
<!--
function breakout_of_frame()
{
if (top.location != location) {
top.location.href = document.location.href ;
}
}
-->
</script>
...
<body onload="breakout_of_frame()">
====================The above is from: http://www.thesitewizard.com/archive/framebreak.shtml
Another, shorter example: http://www.irt.org/script/473.htm
Actually, now that I've RTFA, it looks like the one DF linked to originally is swell, and doesn't require using onload:
I don't think Gruber goes nearly far enough in explaining his objections, however: he barely bothers beyond an "of course" and appeal to consensus. He does mention that URLs are important, and assumes that people will agree. But if you don't automatically agree, that's not going to carry the argument: after all, the full URL is in the DiggBar, and can be C&Pd by anyone savvy enough to care.
Of course, the real problem is with unsavvy users who are going to start passing around URLs that flow via Digg, a blatant landgrab on their part, but he doesn't really explain this. By talking in passing about fights that we had in 1996 he's talking about ancient history to Digg's audience, and they're simply going to assume he's a cantankerous old grump, rather than realising why Digg's actions should be condemned.
The "fuck you" page doesn't help this cause either: he could have used it to explain why the seemingly-useful bar's actually a bad idea. Instead, he's just going to piss off the hordes. A wasted opportunity, I think.
(Also, if he actually wants Digg to stop this, the best possible way is to point out to Diggers why the salad they're getting is full of shit so they can have one of their classic revolts)
Albeit, not nearly as funny :) I suppose I should be growing out of that kind of humor, thought...
Then tell Digg to disable their stupid bar. Tell them again and again.
That's obviously the idea. The difference between the Diggbar and IE6 is that Digg can solve the problem whenever they want. They can even selectively solve the problem for certain sites, though such behavior would not be very nice.
For some reason I like this method better than frame-busting. To make it useful you could add a link to your homepage on there.
Personally, I don't get why Gruber is so upset. There is an option to always hide the DiggBar. Hover over the X on the right and click the down arrow. Then there's a link that sets a cookie so you never see it again.
To me, he just sounds like a grumpy old man. The thing is useful, simple, and non-intrusive if you don't want to see it. No need to get profane about it...
Might shed some light on the downmods.
I mean, seriously. It is 2009. We are all adults. Are you honestly telling me you are offended, even in the slightest, by hearing the word "fuck"? If so - you got problems.
Swear words are part of the language. Whether one uses them or not depends on the circumstance - inopportune or over-use gets you marked down as lacking class or civility, warranted use is justified and commendable. This is the latter IMO. I personally applaud Gruber telling Digg to "go fuck yourself". That's exactly what I thought, too, and they deserve nothing better.
By trying to label and dismiss his justifiable reaction as "profane", though, you sound not only self-righteous, but as if you are attempting to discredit his argument using moral labels - like someone who is "profane" doesn't merit hearing out. Well, if that's what you think, you can go fuck yourself, too.
If you do use the supplied PHP code on your website, I recommend using strpos() or strstr() instead of preg_match().
if (strpos('http://digg.com/', $_SERVER['HTTP_REFERER']))
header('Location: whateverPage');
But that would block all traffic from Digg, including links in comments, etc. To perform the same check as the regex would require much more code.However, I stand by my Apache recommendation as the best option.