Very very simple share button – Twitter, Facebook, Google+ and LinkedIn

social-icons

Icons above can be downloaded free from picons.me. Vector and all. Awesome.

Social Media sharing javascripts are great. DiggDigg, Markerly, AddThis, ShareThis, AddtoAny, Shareaholic to JavaScript library like Socialite.js, options are endless.

But sometimes, you want something really vanilla.

So, here is what I am working with. But I probably need to do some URL Encoding. (Maybe use tools like this?):

Facebook

<a href="http://www.facebook.com/sharer/sharer.php?u=http://example.com&t=Description" target="_blank">Facebook</a>

Twitter

<a href="http://twitter.com/share?text=Description http://example.com" target="_blank">Twitter</a>

Google plus

<a href="https://plus.google.com/share?&hl=en&url=http://example.com" target="_blank">google+</a>

Linked in

<a href="http://www.linkedin.com/shareArticle?mini=true&url=http://example.com" target="_blank">LinkedIn</a>

bonus: Mail

<a href="mailto: ?subject=Description&body=http://example.com">Mail</a>

You are going to need to URLEncode the text that follows = sign (italic above). To do that in JavaScript, you wrap the string in encodeURIComponent function like encodeURIComponent(string).

(Note: I’ve combed through those from site like this and this and this and this and this and this and this.)

2 Responses to “Very very simple share button – Twitter, Facebook, Google+ and LinkedIn”

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>