Improved Digg Integration Script
Many of you probably already have yellow “digg this” buttons on your websites. I’ve improved the standard “digg this” script, and now you can use the improved version on your own site.
Every time any user visits your site, including users that have never heard of digg, they see the big yellow box. I’ve improved the original “digg this” button so that it will only be visible to visitors to your site that are familiar with digg. That way for most of your traffic you can save screen space, not confuse non-digg users, and simplify your site. However, you’ll still be able to provide an easy-to-use digg button to your digg-savy visitors.
Here’s an example of the improved “digg this” button in action:
How to use the button on your site
In order to use it on your site, simply include the following HTML code where you want the “digg this” button to appear:
You can customize the colors, style, and link, by following the configuration directions for the original Digg integration script.
How does this work?
The script only displays the “digg this” script if the user has already been to either digg.com or www.digg.com. It uses a method for browser history detection described by Henrik Gemal. I first read about this technique on Jeremiah Grossman’s blog.
The script tells if a user has visited digg.com by first creating an invisible link on the page to digg.com. It then reads in the color of the link. If the color of the link matches the color for already visited links, then the script knows that the user has already visited digg.com. Even if the user has configured non-standard colors for their links, CSS is used to set the color of the invisible links to a known value.
Compatibility
The script has been tested with Internet Explorer, FireFox, Opera, and Safari. If anyone tests it with any other browsers, please let me know if it works for you.
April 2nd, 2007 at 6:09 pm
Cool, nice work.
April 3rd, 2007 at 1:36 am
Nice one
April 3rd, 2007 at 1:39 am
That’s very useful information. Digg is already very popular and expect to see more traffic to your site through digg.
April 3rd, 2007 at 4:41 am
Thanks for the great feedback everyone! A reader tested the code with Opera and it works.
April 3rd, 2007 at 7:44 pm
A friend tested the script in Safari, and it seems to work.
April 9th, 2007 at 5:55 pm
Clever, but the trouble is that Digg users are tech-saavy and much MORE likely than the average user to manage their histories closely and employ plugins which obfuscate them and clean them regularly. In other words, you’ll be excluding exactly the audience you’re trying to target, all just to avoid confusing the audience you’re not. Really fun experiment, I gotta say, but I can’t possibly recommend using it.
April 9th, 2007 at 6:01 pm
Matt, that’s true. Many Digg users I know also mainly use RSS to keep up with what’s on Digg.
One goal of the script is to allow people that would normally not clutter up their with site with a “Digg This” button to at least sometimes place a button on their posts. Likewise you could create similar buttons for all of the major social news sites. When a user visits your site, they would only see buttons for the social news services that they use.
April 12th, 2007 at 3:08 pm
[...] to our earlier improved Digg button, we’ve also created a reddit button. The button will only display for users to your site that [...]
April 13th, 2007 at 1:53 pm
Digg buttons with smarts!…
Andrew “Drew” Hintz put the CSS History Hack to good use. He made a JavaScript include that only shows the “Digg” button to users who have actually been to Digg.com….
April 13th, 2007 at 6:57 pm
[...] like our earlier Digg and reddit buttons, we’ve also created a Netscape voting button. The button will only display [...]