Updated: Comment #10

Problem/Motivation

Just now I guess AddThis had their server go down or something, because all pages with AddThis on them are simply showing a white page and timing out. The bar at the bottom says "waiting on s7.addthis.com"

I know you don't control their servers, but shouldn't this script only be loading after the rest of the page? Correct me if I'm wrong but isn't this just a matter of needing to wrap the call in a a document.readyState?

I am using development because I found the other release to be missing a bug fix that I was encountering. But this bug is worse.

This kind of thing can't happen on a production site. Any way around it for the time being or will I just have to find another route to social media?

Thanks much in advance. Great module but hopefully this can be resolved.

Proposed resolution

Please review this issue. It should fix this problem too.
#1919156: Addthis analytics not working

Remaining tasks

There is something wrong with the asynchronous loading script. This should be fixed. (See comment #5) More information is needed for this and input on the current approach of async loading is welcome.

Comments

matglas86’s picture

Status: Active » Needs review

1. Could you please test this patch and see if this fixes your problem. I moved the loading of the javascript to the footer for non async setting.

2. Please check in /admin/config/user-interface/addthis/advanced in the section "Advanced settings" if "Load Widget javascript Asynchronous" is check. If not please test that too.

If this works for you please let me know so I can commit this patch.

matglas86’s picture

StatusFileSize
new3.87 KB

I don't know why but my patches are removed. If someone did it please let me know why.

== Edit ==
Patch is wrong. Contains stuff from a different issue.

matglas86’s picture

StatusFileSize
new1.51 KB

I committed the wrong patch. This has changes from a different issue also :) Here is the correct patch.

moonray’s picture

It looks like some form of asynchronous loading is in 7.x-4.x-dev. It fails.
When I turn the asynchronous flag off, the js loads for me. There's something wonky with the anychronous loading script.

matglas86’s picture

Issue summary: View changes
Status: Needs review » Needs work

So it needs work

areke’s picture

Issue summary: View changes
matglas86’s picture

Issue summary: View changes

@moonray can you provide more information on the issue because when I test this it work correctly.

  1. We load the base widget url depending on http or https.
  2. We load the profile id or pubid
  3. If async settings is set to true we add the async=1 parameter.
  4. We load the page and send the url to Drupal js settings.
  5. On page load we load the script with jquery.getScript
  6. The success callback is fired and loads the ajax functionality with addthis.init().

As I wrote it works with me but when I wrote this down I thought that it might happened differently on browsers or depending on the fired events. We could through out the jquery.getScript on and add it by default so addthis executes the async by itself.

At the time of building this I thought that it might be good make Drupal responsible of doing the async stuff by loading the script after the page was loaded.

Any feedback on this approach is welcome.

matglas86’s picture

I think I fixed this issue now with the patch in this issue. Its related.
https://drupal.org/node/1919156

matglas86’s picture

Status: Needs work » Needs review

Review the issue I mentioned in the comment before.

matglas86’s picture

Issue summary: View changes
matglas86’s picture

If this issue does not receive feedback based on the proposed solution I'm going to close it next week. If you problem is not fixed with the latest development release please open a new issue.

matglas86’s picture

Status: Needs review » Fixed

Probably fixed with #1524720: Unnecessary load of AddThis libraries on every page, even in admin pages. Closing it. If any issues arise please reopen this issue and explain the problem in more detail.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.