The solution is to load AddThis script in asynchronous mode. This
would prevent AddThis from loading other assets except the initial
script. After loading this initial script your website will break
connection with the AddThis server and load itself further. When your
website’s DOM has fully loaded, you can call the init() function of
AddThis to resume loading of AddThis assets.
To do this, just add the following parameters to your script call
async=1&domready=1
So, instead of the following code:
1 | < script type = "text/javascript" src = "http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4f3e33c72b9a4e40" ></ script > |
Use this one (change the pubid parameter to your pubid):
1 | < script type = "text/javascript" src = "http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4f3e33c72b9a4e40&async=1&&domready=1" ></ script > |
And then call the
init() function right before closing the body tag
1 | <!-- Call for AddThis init() function --> |
You’ll see that your AddThis widget is loading faster than before. Of
course there could be other reasons that might be slowing down your
website. You should look at them separately.
ref:
http://techwelkin.com/slow-addthis-reason-and-solution#.Ui7RjaydnLY
Inga kommentarer:
Skicka en kommentar