fabiokz
fabiokz

Reputation: 31

How to share on google plus using javascript?

How can I customise link and description when I share on google plus? For facebook I'm using the code below:

<div id="fb-root"></div>
<script>
    (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js";
        fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));

    // async init once loading is done
    window.fbAsyncInit = function() {
        FB.init({appId: 1521111137330543, status: false});
    };



        function shareF() {
            FB.ui({
                method: 'feed',
                link: 'http://example.com',
                picture: 'http://example.com/assets/images/logo2.png',
                name: 'Example',
                caption: 'Here my title',
                description: "Here my description"
            });
        }

</script>

Can I do something similar using google plus?

Thank you!!

Upvotes: 1

Views: 3996

Answers (1)

Hazarapet Tunanyan
Hazarapet Tunanyan

Reputation: 2865

If you want to share you webpage with Google+,you must have configured your meta tags,because Google uses meta tags for making share.The url google gives from "canonical" link. Here is a link: http://www.w3docs.com/learn-javascript/google-share.html

Upvotes: 2

Related Questions