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:
If you don’t see anything here, visit
digg.com, return to this site, and then press Reload or Refresh. If you want to see for yourself that this button doesn’t display to non-digg users, bookmark this page, clear your browser history, close your browser, and then visit this page again.
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.