Wikipedia:Reference desk/Archives/Computing/2014 May 6
Appearance
Computing desk | ||
---|---|---|
< May 5 | << Apr | May | Jun >> | May 7 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
May 6
[edit]Javascript Error: "Uncaught ReferenceError: __adroll is not defined"
[edit]Hi, Recently I added AddThis share buttons on my blog. And they went suddenly disappeared one day. When I contacted their support team, they told that it's due to a Javascript error. Also, they sent me a screenshot. There I could see an error named Uncaught ReferenceError: __adroll is not defined. I've searched a lot on net to find a solution to fix this. But couldn't find one. Can anyone help me out to fix this?--Joseph 03:22, 6 May 2014 (UTC)
- First off try just regenerating the code from their website. You may be linking to an out of date script. If that does not work post the code you used or add a link to your website, we would need more details to help. You could try it just on a blank page to see if anything else is conflicting.--Salix alba (talk): 07:22, 6 May 2014 (UTC)
- I've removed the code and used a new one from their site. But it doesn't solved the problem. Here is the code I'm using:
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5358bd9112b31987"></script>
<script type='text/javascript'>
var addthis_product = "blg";
document.doAT = function(cl)
{
var myclass = new RegExp('hentry');
var myTitleContainer = new RegExp('post-title');
var myPostContent = new RegExp('post-footer');
var elem = this.getElementsByTagName('div');
var url;
var title = "";
for (var i = 0; i < elem.length; i++)
{
var classes = elem[i].className;
if (myclass.test(classes))
{
var container = elem[i];
url = window.location.href;
for (var b = 0; b < container.childNodes.length; b++)
{
var item = container.childNodes[b].className;
if (myTitleContainer.test(item))
{
var link = container.childNodes[b].getElementsByTagName('a');
if (typeof(link[0]) != 'undefined')
{
var url = link[0].href;
var title = link[0].innerHTML;
}
var singleq = new RegExp("'", 'g');
var doubleq = new RegExp('"', 'g');
title = title.replace(singleq, ''', 'gi');
title = title.replace(doubleq, '"', 'gi');
}
if (myPostContent.test(item))
{
var footer = container.childNodes[b];
}
}
var n = document.createElement('div');
var at = "<div class='addthis_toolbox addthis_default_style addthis_32x32_style' addthis:title='"+title+"' addthis:url='"+encodeURI(url)+"' >
<a class='addthis_button_preferred_1'></a>
<a class='addthis_button_preferred_2'></a>
<a class='addthis_button_preferred_3'></a>
<a class='addthis_button_preferred_4'></a>
<a class='addthis_button_compact'></a>
<a class='addthis_counter addthis_bubble_style'></a> </div> ";
n.innerHTML = at;
container.insertBefore(n , footer);
}
}
return true;
};
document.doAT('hentry');
</script>
And this is my blog. What all more details should I provide you?--Joseph 11:48, 6 May 2014 (UTC)
- I've tried this code and it works for me. You need to change the code from the line
var myclass = new RegExp('hentry');
tovar myclass = new RegExp('h-entry');
as their seems to be an incompatibility with you blogspot page and the code addthis is expecting. Is you software upto date? - I think the __adroll issue is something separate. The error message you are getting seems to refer different site.--Salix alba (talk): 13:13, 6 May 2014 (UTC)
- Wow! That fixed it. Thanks a lot Salix alba. You're a genius!--Joseph 13:39, 6 May 2014 (UTC)
Resolved