Hot Topics

Magento – Database Queries

Magento is a complete and awesome MVC application. It’s fully moduler and easy to extend its features and functionality. All…..

Jquery – google CDN fallback to local hosting

Using the Google hosted Jquery and other Libraries on the website is the best method to speed up the things and saves a lot of bandwidth as well. Other benefit is that it provides synchronous loading.

In case if google server is down, fallback to own hosted Jquery keep the website running with proper functioning. Given code will load the jquery from the Google CDN and if it fails than load from the own host.

<!-- Load the Google CDN’s Jquery -->
<script src="//"></script>
<!-- check if jquery is loaded and active else load the jquery from own hosting -->
<script>window.jQuery || document.write('<script src=""><\/script>')</script>