Caching Trustlogo and other third-party js files
A couple of days ago my site wasn't loading due to the Addthis server not responding when my pages were trying to load the Addthis javascript file. This has also happened in the past with the Comodo trustlogo. It really sucks when this happens as you have no control over the other server and you need to hack your site real quick to get the references off your site to get it up and running - once you notice it.
Well, the solution is really pretty simple. Copy the javascript files to your server and load them from there. Doh! Why didn't I do this years ago? But you want to be sure you load the latest version of the javascript file. So setup a cron job to recopy the files every night. Simple and effective. To do this first add a directory called "cache" in your xcart directory where you will store copies of the js files on your server. For a Comodo trustlogo you will have something like this in one of your templates: Code:
<script language="JavaScript" src="https://secure.comodo.net/trustlogo/javascript/trustlogo.js" type="text/javascript"></script> Before you change this go to your web hosting control panel and setup a cron job to copy the trustlogo.js file to your cache folder once a day using this command: Code:
wget https://secure.comodo.net/trustlogo/javascript/trustlogo.js -O $HOME/www/cache/trustlogo.js Now go ahead and change the <script> tag in your template to: Code:
<script language="JavaScript" src="{$current_location}/cache/trustlogo.js" type="text/javascript"></script> No more hangs if the Comodo server isn't responding. I did the same thing for my Hackerproof logo javascript and my Addthis javascript. Now no more scrambling to figure out why my site's not loading and scrambling to rip out a logo or Addthis. |
Re: Caching Trustlogo and other third-party js files
Always a great idea. Lots of third party companies don't minimize or compress their js either, so you could do that to make your site load even faster. Additionally, the js could be loaded from a CDN.
|
Re: Caching Trustlogo and other third-party js files
That's great Ralph. Wish we had this before all the problems with Comodo last year ;)
Any idea if this works (or variations) for GoDaddy's Site Seal and McAfee's Site Seals? |
Re: Caching Trustlogo and other third-party js files
Yeah, it seems to be an annual thing with Comodo and usually when I'm too busy to do anything but rip the seal off the site. Wish I'd thought of it sooner.
I'm not real familiar with the other seals but I don't see any reason it wouldn't work wherever they load a js file. |
Re: Caching Trustlogo and other third-party js files
Anybody get this to work with the Comodo corner of trust.
If you try this with McAfee Secure you get a blank image for the get. Darn it! |
All times are GMT -8. The time now is 04:31 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.