how to speed up social network badge loading

I have had some problem with my Tripit badge on the left of the screen. For some strange reason it wouldn’t load on my Google Chrome. It would load if I would open this page with Firefox or IE though. The weirdest thing is that after loading it from Firefox or IE, I could then load it with Chrome. 

So I decided I would take a different approach and cache the badge somewhere.

Here is how to do it:

First get the URL of the javascript file of your badge.

Here is the code of my badge:

<div id="tripit-badge"><script type="text/javascript"
<a href="">TripIt - Organize
your travel</a></noscript></div>


The red part is what I am interested in.

So I am going to create a crontab in order to download that file on a regular basis.

I’ll run it every 10 mins:

*/10 * * * * wget \
-O /var/www/cache/badge.js

Then I’ll change the badge code to the following:

<div id="tripit-badge"><script type="text/javascript"
<noscript><a href="">TripIt -
Organize your travel</a></noscript></div>


Note the red part again:

Be careful not to link to my js file…

Leave a Reply

Your email address will not be published.