There seems to be a recent change to the AddThis JS that results in the share buttons failing to display. This thread on their forum talks a little bit about it:
http://www.addthis.com/forum/viewtopic.php?f=4&t=33111
As noted there, the workaround is to move the AddThis JS out of the head and into the body. Right now, the module uses drupal_set_html_head() to add a
addthis_preprocess_page() could append it to the page content?| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 1222918-11.patch | 1.5 KB | stu1984 |
| #10 | 1222918-10.patch | 1.48 KB | stu1984 |
| #8 | 1222918-8.patch | 1.49 KB | BrockBoland |
Comments
Comment #1
najyk commentedSubscribing. Hopefully someone can solve this soon!
Comment #2
najyk commentedI would also set this as critical, as it renders the module completely inoperable.
Comment #3
les limI can't quite figure out the nature of this bug from the AddThis.com forum report you specified. The share widgets appear to be working fine on my own websites - the JS file is lazy-loaded and initialized from the bottom of the BODY element, so I wonder if that shouldn't already cover this.
What site are you experiencing this on?
Comment #4
Alessandro Pezzato commentedMaybe this is the same issue: #1217644: AddThis script doesn't load when block cache is enabled
Comment #5
BrockBoland commentedI don't think it's related to that other issue: the code is there, but the buttons aren't loading. In particular, this is happening on a page displaying a View block that has the Node: AddThis toolbox field.
One of the devs I work with got around it by hacking the module to make it work for now. We removed this whole block:
And added this to
addthis_footer():Comment #6
les limI can't reproduce this bug. If someone could point me to a URL for a site that's experiencing this or tell me steps to reproduce, that would be helpful.
Comment #7
stu1984 commentedI believe this issue is occurring on one of the sites I maintain. An example of where it isn't working can be found here: http://www.itvbabysign.com/about-itv-babysign.
The AddThis block appears to work on my homepage, which uses panels, however it has disappeared on every other page. I haven't made any changes, they just disappeared one day, which is why I think it is related to the issue of the Javascript code being changed by AddThis. Any help would be greatly appreciated thanks.
Comment #8
BrockBoland commentedThe attached is an incomplete patch. Don't apply it to your production site and expect it to work - we're still trying to determine whether or not there's anything to be fixed.
That being said, stu1984, could you apply this patch to your site and see if it works :-P This is what we did to fix ours, though it removes the addthis_cache_js check so it's not a complete solution.
You can see it working on the Amnesty USA site: http://www.amnestyusa.org/news/press-releases/amnesty-international-call...
Comment #9
stu1984 commentedThanks for letting me be the guinea pig for this fix ;-) Thankfully we have an internal dev version of the site which is exactly same and was suffering the same issue, so I used that instead. Initially when I applied the fix it brought the whole site down (execution times suddenly increased beyond the 60 second limit). However I tried playing with updated code and found that the problem lay with this line:
drupal_add_js('http://s7.addthis.com/js/250/addthis_widget.js#async=1', 'external', 'footer');Changing it to the following allowed the site to work and the AddThis buttons came back on all pages:
drupal_add_js('/s7.addthis.com/js/250/addthis_widget.js#async=1', 'external', 'footer');After reading about the drupal_add_js function I guess it was adding an extra leading slash, as it creates a path relative to the base path. This would mean it was originally trying to access a file at '/http://s7.addthis.com/js/250/addthis_widget.js#async=1' which wouldn't work. I'm not sure how this worked on your site, maybe a server configuration or something like that. Hopefully now we have a starting point to get this issue sorted.
Comment #10
stu1984 commentedHere is the edited patch file.
Comment #11
stu1984 commentedFound an issue with the previous patch can occur if the Javascript caching option is enabled in the 'Performance' section of the site, as it will try to optimize the file which causes problems. Adjusted code so that this is not an issue.
Comment #12
ericclaeren commentedThanks, had a problem with a disappearing like button, this patch did the trick for me.
http://drupal.org/node/1231636#comment-4807098
Comment #13
les limI committed a fix just now that moves the AddThis script execution to the footer. It should be repackaged as the latest 6.x-3.x-dev version with an August 5 date.
@stu1984: Unfortunately, drupal_add_js() can't be used that way officially, since it won't work if your base_path is anything other than "/".
Comment #14
stu1984 commented@Les Lim: Thanks for creating a proper fix for this issue. Knew that the fix I uploaded was a bit rough, but it was just to get something working until someone with a bit more knowledge of how this module worked came along. Had a look at your solution and now have a better idea where I went wrong.