0

I've been testing page speed and noticed that if I remove these 2 buttons the page load speed drops by around 3 seconds from 4 seconds to 1 second. Therefore it would obviously be of great advantage to speed to load of these buttons or otherwise remove them.

I'd like to keep them and I'm looking at how to speed them up. I read about Aync loading and currently for Twitter I load the script at the bottom of the page after page load (note: script loads just before the end body tag):

$(window).load(function() { !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.async=true;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); }); 

Note: I can see the delay on sites like http://www.webpagetest.org.

Question: Is there a way to load this onto the page so its not included in the initial page load?

Maybe once the page is loaded I could wait for an event (mouse movement) and then load these scripts? This should/could remove there delayed load from the initial page load.

Note: I've tried different jquery options like below but these still include this in the initial page load:

$(window).load(function() { $(function() { 

thanks

1 Answer 1

1

I would recommend putting the twitter/facebook files you are referencing on your local server. They can get bogged down at times from overusage.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.