Thursday, 5 January 2012

How to create a 'Share on Google plus' button

We have seen websites sporting a 'Share on Facebook' button but I've not stumbled across any website that let's you share something on Google plus by simply clicking a button. Like Facebook's like button, Google has provided webmasters with a +1 button but that only let's you +1 it i.e you can not post your views, opinions whiling pressing the +1 button on a website.

Now you can add a button that allows users to share your website and their opinions on Google plus. Here's how:

This is the Javascript function:


function shareOnPlus(content){
  window.open('https://m.google.com/app/plus/x/?v=compose&content='+content);
}


Now you can associate this function to onclick event of any button or image and let users share you website on G+ like they do on Facebook.

Example:

<img src="icons/google_plus.png" alt="Share on Google plus" 
onclick="shareOnPlus('Interesting article at technoslab.blogspot.com');" 
/>



0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More