zizoujab
zizoujab

Reputation: 7800

G+ share not working

I am having this code ,

<g:plus action="share" href="{{url}}" style="height: 28px;" ></g:plus>

<script type="text/javascript">
      window.___gcfg = {
        lang: 'en-US'
      };

      (function() {
        var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
        po.src = 'https://apis.google.com/js/plusone.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
      })();
    </script>

I am supposed to get a share on G+ of url but instead I am getting a share of

current url/url

Why ??

Upvotes: 0

Views: 78

Answers (1)

zizoujab
zizoujab

Reputation: 7800

I was sending an url without http://... ( a relative url ) that's whay google api adds the current url to my url.

so the solution is sending an absolute url not a relative one.

Upvotes: 1

Related Questions