Saturday, August 20, 2016

// // Leave a Comment

ShareThis Asynchronous Javascript Loading

Unfortunately the ShareThis service has a lot of known issues, like loading a lot of data from their tracking site, b.scorecardresearch.com and other types of bloat when initializing their icons.
Because calling stLight.options depends on having the buttons.js script already loaded, it is not really feasible to initialize the code like this:

However, you could use an onload function to do the stLight.options, and then wrap the entire thing inside of a function that won’t interfere with the global namespace, like this:


Make sure to update your publisher ID in the code above if you copy / paste it.

0 comments:

Post a Comment