Social Sharing without Javascript

I write a book on the pros and cons of Javascript. As a web developer, of course, I use it daily, but I always try to keep it to a minimum. While writing my new theme for this site, I wanted to make an extra effort to be smart phone friendly and limiting the server overhead is always a great place to start. 🙂

I noticed a performance lag after adding 10 or 15 social sharing icons. I recently checked my site performance only using Google+, Twitter, Facebook and LinkedIn. They were making a total of 2000 separate requests per day! You are unlikely to notice this on high-speed networks, but if you’re accessing the same site on a mobile device under poor connection, those 20 simultaneous requests could make a big difference.

With these code snippets you can keep the requests down to just the four for the images (or less depending which ones you want to use!). You will lose some functionality by not loading the javascript (like your share counts), so you’ll have to make a call on what’s more important for your site.


HTML Codding:
While fully functional there are limitations, especially on dynamic sites like this one. You will need to past this code on each page separately. I would, of course, suggest that you copy the code after you configure all of your site and page titles and your username within all of the links below.

Which gives you text links, like so:
Share on Facebook | Tweet | Share on Google+ | Share on LinkedIn

PHP Coding:
The obvious advantage on a dynamic site means that you only need to insert these snipplets into your post/page template and edit the user ID and your finished.

Which also gives you text links, like so:
Share on Facebook | Tweet | Share on Google+ | Share on LinkedIn

Dynamic with image buttons:

Which should look like this:      
Don’t forget to drop the image files into your Theme’s Image directory 🙂