Posted on Thu 15 March 2012

Better privacy with 2-click social buttons

Today I noticed that the social network buttons on my blog had disappeared - I quickly realized that this was because I had recently reset my theme. Of course, I had to bring those buttons back, but better. By chance, I stumbled over the [cached]socialshareprivacy project (sorry, german only. [cached]project site with downloads) of german news site and publisher heise.

I was intrigued. Not only because this would mean better privacy, but also because of another welcome side effect: Faster page load times! After all, if we only load those buttons and their .js and .css files when we need them, we can save up to then requests. However, heise's project still uses a custom javascript library to place the buttons and relies on jQuery - overhead that I wanted to avoid. So I rewrote the code to only use static HTML and inline javascript. You can see the result at the bottom of each post here, or in [cached]this gist (the gist also has the .css file).

It's really simple: We have an ulist of our buttons. At the beginnig, we just show a greyed out image for each one. If you click it, it's replaced by the real button. I've also added HackerNews and Reddit buttons - the original only contains Facebook, Google+ and Twitter. Hope you like it :)

Tags: web, privacy

© Julian Schrittwieser. Built using Pelican. Theme by Giulio Fidente on github. .