Skip to content

Instantly share code, notes, and snippets.

@paulherron
Created January 16, 2012 22:03
Show Gist options
  • Save paulherron/1623263 to your computer and use it in GitHub Desktop.
Save paulherron/1623263 to your computer and use it in GitHub Desktop.
Creating a 'Share on Google+' URL with this Dubious Clusterhack

#Creating a 'Share on Google+' URL with this Dubious Clusterhack

Disclaimer: This is a ridiculous set of hacks. I had fun messing about with this and wanted to share it, but I wouldn't recommend using it for anything important. It may stop working at any time.
tl;dr: Google doesn't support sharing arbitrary URLs via a simple share link, but you can work around it by doing a redirect via Google, like so: https://plus.google.com/share?url=http%3A%2F%2Fgoogle.com%2Fsearch%3FbtnI%3D1%26q%3Dshowstudio%26sourceid%3Dnavclient

Most social sites let you share a link by visiting a special URL, for example:

Twitter. http://twitter.com/home?status=http://showstudio.com
Facebook. http://www.facebook.com/sharer.php?u=http://showstudio.com

As far as I know, Google+ doesn't support this. There are some workarounds, several of which are noted at http://stackoverflow.com/questions/6676658/share-link-on-google, but none of them seemed to work properly for me.

This one intrigued me though:

Yes, you can.

https://plus.google.com/share?url=YOUR_URL_HERE

Edit: It works only with eff.org.

Someone elsewhere noted that it also works for google.com, and I noticed it seemed to work for any google.com URL, not just the homepage.

So, to craft a google.com URL that redirects to the page you want to share. With a couple of URL parameters you can create an "I'm Feeling Lucky" link that redirects automatically:

http://google.com/search?q=showstudio&btnI=1&sourceid=navclient

URL encode this and pop it on the end of the share link noted above, and it should work:

https://plus.google.com/share?url=http%3A%2F%2Fgoogle.com%2Fsearch%3FbtnI%3D1%26q%3Dshowstudio%26sourceid%3Dnavclient

The bonus is that it seems to actually resolve the redirect, so presents you with the actual title of your site, and allows you to select an image from it:

Alt text

Obviously, this is presenting Google's top result for your query, so you'll need to be sure you'll come up first! Easy if you're trying to present a link to your homepage - harder if you want to present a specific subpage of your site. You could of course use extra search parameters like site:example.com or inurl:example.com/project/test_project to narrow it down a bit.

@designdigit
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment