Question

I'm using AddThis to render group of social media icons in the header of each page of my web app.

This is a Single Page Application (SPA), built on Angular.

So whenever the user navigates to another page, there's not a full page reload, but the components on the page are reloaded.

The trouble is, all the AddThis configuration stays the same. So even when the social media buttons get refreshed, the same sharing URL is shown when the user clicks the Facebook sharing button.

How can I clear this and replace it with the current page URL on each page reload?

Was it helpful?

Solution 2

I had the same problem, but I found out that you could simply call addthis.toolbox() when you want the links to update.

OTHER TIPS

From mucking around in the Chrome Console, I discovered a global property, addthis_share, which seems to allow me to update the sharing URL.

So I used code like this to updated it on each page reload:

window['addthis_share'].url = window.location.href;
window['addthis_share'].title = window.document.title;

I've encapsulated all the reloading code into a function, addthis_reload.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top