Anks
Anks

Reputation: 485

addthis share facebook and google+ url

I am attempting to use AddThis to create simple URL shares for whichever current page the user is on when they click the share button. As of right now, I have Twitter working. When the user clicks, they are able to see the URL populated in the tweet box. Now when the user clicks Facebook or Google+, the URL doesn't seem to show up in the share box.

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

I feel like I might be missing some Facebook or Google+ parameters. Any help would be greatly appreciated.

Upvotes: 1

Views: 5470

Answers (3)

aram063
aram063

Reputation: 1133

I assume you're trying to integrate in your local development environment and your URL is something like localhost:8080. It looks like Google Plus and Facebook invalidate localhost. So its not that they G+ and Facebook don't work, they're just invalidating the URL. If you hard code the URL to be something else, for example www.example.com, both Facebook and Google Plus should work correctly.

A tutorial on how to specify the URL is available at http://support.addthis.com/customer/portal/articles/381242-url-title

Upvotes: 1

rink.attendant.6
rink.attendant.6

Reputation: 46208

From the documentation, it also says you can use JavaScript.

Therefore, you can use document.URL, like so:

var addthis_share = {
    url: document.URL
};

Upvotes: 0

Anand
Anand

Reputation: 14915

I have test this and this works

check it out on 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>

Upvotes: 0

Related Questions