Thursday, November 15, 2012

Use jQuery CDN with fallback

Use jQuery from CDN, because it is usually cached. Always use fallback (Sometimes Google fails).
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
if (typeof jQuery == 'undefined')
{
document.write(unescape("%3Cscript src='/path/to/your/jquery' type='text/javascript'%3E%3C/script%3E"));
}
</script>

No comments:

Post a Comment