簡體   English   中英

添加此分享facebook和google +網址

[英]addthis share facebook and google+ url

我試圖使用AddThis為用戶單擊共享按鈕時所在的當前頁面創建簡單的URL共享。 截至目前,我正在使用Twitter。 當用戶單擊時,他們可以看到在tweet框中填充的URL。 現在,當用戶單擊Facebook或Google+時,URL似乎沒有顯示在共享框中。

<ul class="addthis_toolbox addthis_default_style ">
    <li><a class="addthis_button_facebook"><img src="/img/facebook-social.png" width="20" height="20" border="0" alt="Share" /></a></li>
    <li><a class="addthis_button_twitter"><img src="/img/twitter-social.png" width="20" height="20" border="0" alt="Share" /></a></li>
    <li><a class="addthis_button_google_plusone_share"><img src="/img/google-social.png" width="20" height="20" border="0" alt="Share" /></a></li>
</ul>

我覺得我可能缺少一些Facebook或Google+參數。 任何幫助將不勝感激。

我假設您正在嘗試集成到本地開發環境中,並且您的URL類似於localhost:8080。 看起來Google Plus和Facebook使本地主機無效。 因此,並非G +和Facebook無法正常工作,而是使URL無效。 如果您將URL硬編碼為其他名稱,例如www.example.com,則Facebook和Google Plus均應正常工作。

有關如何指定URL的教程,請參見http://support.addthis.com/customer/portal/articles/381242-url-title

我已經對此進行了測試

JSFiddle查看

<div class="addthis_toolbox" addthis:url="http://example.com/blog/post/2009/05/01" addthis:title="Hooray!">
<ul class="addthis_toolbox addthis_default_style ">
<li><a class="addthis_button_facebook"></a></li>
<li><a class="addthis_button_twitter"></a></li>
<li><a class="addthis_button_google_plusone_share"></a></li>
</ul>
</div>

文檔中 ,它還說您可以使用JavaScript。

因此,您可以使用document.URL ,如下所示:

var addthis_share = {
    url: document.URL
};

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM