Reputation: 767
How to share content from our site to google plus
I tried it like this
<a href="javascript:void(0);" onclick="window.open('https://plus.google.com/share?url=<?php echo urlencode('http://example.com');?>&via=example', 'Share on Google Plus', 'width=600,height=400,left=450').focus();" >
Here I can not share content from my site. How it is possible with this? I want to share content (example: hello) to goggle plus with sharing capability
Upvotes: 0
Views: 870
Reputation: 118
yes. You can paste a content from your app which you have to set as a default data.. https://developers.google.com/+/web/share/interactive#button_attr_calltoactionurl
Nothing much to do here..
Just create a google plus app on the developers section. Then Paste the below portions
<button
class="g-interactivepost"
data-contenturl="https://plus.google.com/pages/"
data-contentdeeplinkid="/pages"
data-clientid="xxxxx.apps.googleusercontent.com"
data-cookiepolicy="single_host_origin"
data-prefilltext="Engage your users today, create a Google+ page for your business."
data-calltoactionlabel="CREATE"
data-calltoactionurl="http://plus.google.com/pages/create"
data-calltoactiondeeplinkid="/pages/create">
Tell your friends
</button>
Then change the data- client id.. Now it will work as per your expectation. Enjoy :)
Upvotes: 2