-->

Addthis ads a hashtag and id to URL - how to remov

2019-08-28 22:57发布

问题:

In our CMS the developer added an "addthis.com" script which appends a hashtag and a tracking id to the browser address bar URL, for example http://www.site.com/about/#.UX6e2j7mK30

There is a solution how to get rid of this tracking but we are limited with CMS which only allows us to add javascripts to page header. The addthis script executes within page body and I need somehow to run the fix script after the default script has run. When I add the below script then the fix doesn't work. Is there any solution? Many thanks

<script type="text/javascript">
$(document).ready(function() {
    var addthis_config = addthis_config||{};
            addthis_config.data_track_addressbar = false;
    });
</script>

回答1:

Remove the $(document).ready and just declare addthis_config. Since this is just defining the configuration values for AddThis, there's no need to wait for the document to fully load. Because you're waiting for the document to load and then setting addthis_config, the AddThis code has already run and appended the addressbar tracking hash.