How to Make a Custom Google+ Share Button

Every social network has a url which allows you to easily share your site. Facebook’s sharer.php and Twitter’s ?status= are the most common examples. Google plus has one as well:

Using that url you can easily make a quick share popup with just a few lines of javascript:

function GPlusShare(pUrl){
// Set up the window attrubutes
var attributes = "toolbar=0,location=0,height=450,width=550";
// Format the share url
var url = ""+escape(pUrl);
// Open the window,'',attributes);

This function can be called from anything that can access the javascript, including Flash. In this example, I used the red g+ button image:

The Google+ share uses facebook’s open graph meta-tags to derive the title, description, and image. Add these to the page you’re sharing to further customize the post. You can view the button in its own page to see the source, as well as some extra code to center the window on screen.

This entry was posted in Tech Tip, Web Development. Bookmark the permalink.

3 Responses to How to Make a Custom Google+ Share Button

  1. I actually Think blog, “How to Make a Custom Google+ Share Button
    |” ended up being spot on! Icannot see eye
    to eye with you even more! Finally appears like I actuallyidentified a
    site truly worth reading. Many thanks, Noreen

  2. Amit Singh says:

    Can have callback after share from customize button in glus

  3. kingsley says:

    I just want to join

Leave a Reply

Your email address will not be published. Required fields are marked *