Addthis ads a hashtag and id to URL - how to remove it

江枫思渺然 提交于 2019-12-24 22:16:31

问题


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.



来源:https://stackoverflow.com/questions/16283707/addthis-ads-a-hashtag-and-id-to-url-how-to-remove-it

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!