Hi!
I noted that all my pages, even the admin ones, were really slow before I install the AddThis modules.
And with a little debug i findout that all the Js and Css files for the widget were being loaded in every page.
So I made a not definitive patch(I guess) to this problem, creating a checkbox to disable the "every page load", and it will only appears if you install the "addthis_displays". And now only will be loading the AddThis files when a field is being view.
I hope others understand my problem, and help me to make a better solution to this.
Cheers!,
Sebas.
Proposed solution
Only load the widget and related resources when displaying a AddThis share widget.
Comment | File | Size | Author |
---|---|---|---|
#9 | addthis-load_ever_page_problem-9.patch | 2.12 KB | matglas86 |
Comments
Comment #1
sebas5384 CreditAttribution: sebas5384 commentedComment #2
matglas86 CreditAttribution: matglas86 commentedI think I would like to do something like using
path_is_admin
and exclude it there. Or do a lazy loading on specific javascript. Like when I find addthis link decoration act and load the library. We can do that with jQuery easily.I think the patch from #1 is a little to much.
Comment #3
sebas5384 CreditAttribution: sebas5384 commentedI just dont want to load the addThis libraries in pages that there is not need for it.
With Javascript lazy loading can be a probably solution, but in some way you are loading other javascripts files you dont need.
My point is, dont load anything in the front, that you dont't really need.
Comment #4
Matthew Davidson CreditAttribution: Matthew Davidson commentedA real edge case, but related, is that when you're a tinfoil hat wearer like myself and use the Firefox Ghostery addon to block spyware scripts like AddThis, ajax callbacks on admin pages are clobbered by:
... rendering - among other things - content type configuration impossible. It took me way too long to work out why this was happening, so solving the above problem will help here as well.
Comment #5
tim.plunkettThis is a bug.
Comment #6
tim.plunkettDoing load tests on a site using AddThis, I found some startling results.
On a page that has no AddThis widgets loaded, and no need for the AddThis code at all, all of the assets are still loading.
It is comprising 60% of the HTTP requests and 25% of the load time.
This is when it's not needed at all.
Comment #7
charizard CreditAttribution: charizard commentedHi, we've encountered the same problem in #4, and had a quickfix for it in the patch.
This is only a quickfix so we can still use the normal functionality of Drupal without addthis breaking it, this won't prevent addthis from trying to load itself on every page. It simply skips calling window.addthis.ready().
Hope that this helps someone in the mean time before addthis is fixed up properly to degrade gracefully without affecting other javascript when ghostery and other privacy related features are enabled.
Comment #8
matglas86 CreditAttribution: matglas86 commentedComment #9
matglas86 CreditAttribution: matglas86 commentedI added a load function that load only once when a getDisplayMarkup is called. So only when a specific display is called for display in a page we load the widget. Otherwise you have to call it by hand.
I added a patch that implements this and includes the fix for the non existing addthis.ready function.
Comment #10
matglas86 CreditAttribution: matglas86 commentedIf I don't receive feedback in the coming week I'm going to apply the patch and close the issue. I want to make some progress on the issues.
Comment #11
matglas86 CreditAttribution: matglas86 commentedNow commited and fixed. I any issues arise again please open a new issue.
Commit: a7254