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.