24th of June 2010 3
When working with a clients site i wanted to the sharing script from AddToAny, i however noticed that the inclusion of their javascript bogged the whole site down and caused extreme delays (3+ seconds).

This wasn't acceptable at all so i had to come up with a proper solution which was quite simple with some jQuery and ajax:
We simply dump the code we get from AddToAny and replace the call to their servers with the jQuery ajax scripts that loads "onload". This efficiently kills all slow load delays and the only drawback is that your AddToAny-button(s) only will work when a page has finished loading.
blogjunkie 3:47 am 1/10 of 2010
I’m a total jQuery noob, but isn’t getScript() better for this?
http://api.jquery.com/jQuery.getScript/
ReplyJoe 9:20 pm 17/12 of 2010
Okay, I did further research on share buttons and deciding I really wanted to stick with AddToAny if there were any way to work it out. As far as I can tell, it has the biggest list of networks/options and none of the other share buttons categorize emailing, bookmarks and sharing separately AND have a search field (let alone the pop-up feature one of my clients wanted. So I confirmed what futta’s blog (see my last comment) says about Media6Degrees.com tracking the activity of users of the AddToAny button (it’s true, you can see it in AddToAny’s page.js). Apparently, this is what slows down the load time. As mentioned in futta’s blog comments, AddToAny has added an opt-out parameter to their API (no_3p = true). Once I used this on one of my clients websites, the load time of the AddToAny button went from about 3 seconds to 125 milliseconds.
So the only thing I might need to figure out in the future is how to get it to wait until the page finishes loading to then load page.js. Actually, the only reason I have any concern on that is because addtoany.com recently went into a spell of loading way to slowly, which then affected my client’s site. Perhaps with the tracking turned off, I may not need to worry about this anymore, so I’m only going to continue to keep an eye on it for now.
But this raises a question about your code, since it is designed to achieve that end, and because it didn’t work for me. Did it actually work for you upon trial?
Reply
Tommie Hansen (16 comments) 1:17 am 18/12 of 2010
@Joe: Yes, however my code now is quite old and i have been in contact with them before so my code Might not work.
However i use the code here and it do work, i have no idea of it achieves the disired effect simply because i’m swamped with work and haven’t had time to re-check things unfortunately. :/
If you got propblem, just check this pages sourcecode. :)
ReplyCopyright Tommie Hansen since 2010. All rights reserved. Design and the Absolute Theme by Tommie Hansen.