Search code examples
google-plusgoogle-plus-one

Opening the Google Plus snippet in a new tab or new window


When a user clicks on the +1 button, a snippet opens and gives the user the opportunity to post about her/his +1 on Google Plus.

Is there a way to make the snippet open as a new tab or new window instead of as snippet within the initial page where the +1 button was?

It must be possible, because that's how Sharethis (http://sharethis.com/publishers/get-sharing-tools) does it: when you click on the Google Plus button, it records the +1 and opens the snippet in a new page.

Anyone knows how to do something similar?

Thanks everyone in advance! Best


Solution

  • It looks like ShareThis is using the share URL which opens the share dialog in a new window. It will work as you describe, but it's not quite the same as the +1 button.

    To use the share link, add a link element to your site that complies with the Google+ Buttons policy. Set the href attribute to https://plus.google.com/share?url={url encoded share target}

    For example, linking to https://plus.google.com/share?url=http%3A%2F%2Fexample.com will allow you to share example.com on Google+: Google+ share button (yes, that is a working demo).

    Check out the official docs for more info.

    If you use this approach please be aware of the fact that it is not a direct replacement for the +1 button. The link shares the target URL on Google+, but it does not actually +1 the target page. Only the +1 button can +1 a page.