MedLawPlus.com®
|
Simple Source Code For Social Media Buttons
Twitter, Facebook, and Stumbleupon
I wanted buttons on my blog allowing visitors to share my content through their social network contacts. It took a little bit of digging but what follows is simple source code that should do the trick. It uses javascript so it's portable to any html website. The only catch (a small one) is that the visitor must have javascript enabled in his or her browser.
The above code renders what you see below the date on this page. You only need to make two changes before copying and pasting this code to the pages of your website. In line of code for twitter you find data-via="jjray". Change "jjray" to your twitter screen name. In the line of code for facebook, change www.jjraymond.com/misc/socialbuttons.html to the URL for the page of your website where you are placing this code. Do not put "http://" in front of www.****. It's already there in the code. If you have knowledge of scripting languages, this step can be automated so that it's portable throughout your website without customizing the code for each page.
For those who wish portable code with no server side scripting language, this can be done with the twitter and stubleupon buttons but not facebook. Below is the code without the facebook button. It can be pasted to any page on your website as is. Again, swap your own twitter screen name for "jjray" in the below code.
The above code renders just the twitter and stubleupon buttons.
JJR
4-10-2011
|
|
|