2013-06-04 71 views
0

我有這個代碼,G +份額不工作

<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> 

我應該得到的url G + A股,而是我得到

當前URL的份額/url

爲什麼?

+2

您是否在開始時提供完整的絕對URL,包括協議http/https?否則,該網址將被視爲相對網址。 – Scarygami

+0

謝謝!只需將http://添加到網址,它就像知道魅力一樣 – zizoujab

回答

1

我發送的網址沒有http://...(相對網址),這是whay google api將當前網址添加到我的網址。

所以解決方案發送的絕對url不是相對的。