I’m currently working on a website where the content is loaded via AJAX, every piece of content has some AddThis sharing buttons.
So after the content is loaded and added into a div container, I reload the AddThis script in order to make it work again:
var script = 'http://s7.addthis.com/js/250/addthis_widget.js#pubid=myid&domready=1';
if(window.addthis) window.addthis = null;
$.getScript( script );
But when I share the page, I noticed that the title and url don’t change, I did change the title manually:
var title = $(response).find('h2').text();
window.document.title = title;
window.history.pushState({path: href}, title, href);
Why won’t AddThis use this new title and URL?
Also for the Facebook sharing it’s using the image from the first content. (probably because of the wrong url)
Apparently I forgot to call addthis.update(), this fixed my problem.
AddThis buttons wont update to include fragment (#Hash Tag)