Re:Hotlinking to jquery.com will be disabled on January 31, ...
by wizard_2 on Friday December 31, 2010 @01:41PM
(#2056050)
Stolen from the html5 boilerplate
<!-- Grab Google CDN's jQuery. fall back to local if necessary -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/libs/jquery-1.4.2.js"%3E%3C/script%3E'))</script>
Re:Hotlinking to jquery.com will be disabled on January 31, ...
by mootothemax on Friday December 31, 2010 @01:58PM
(#2056093)
Superb, thank you! I'm more feeling significantly more enlightened :-D
Re:Hotlinking to jquery.com will be disabled on January 31, ...
by adamdecaf on Friday December 31, 2010 @01:32PM
(#2056024)
Most users will have the javascript in their cache anyway, so they won't even be hitting the CDN. Also, why not check to see if the object exists before doing anything else?
<script id="jquery" src="http://code.google.com/jquery.js"></script>
<script>
if (jQuery == undefined) {
document.querySelector("#jquery").src = 'Backup CDN';
}
</script>
That should work, in theory, if not then just remove script#jquery, create a new one and append to the document before executing any script(s).
Re:Hotlinking to jquery.com will be disabled on January 31, ...
by mootothemax on Friday December 31, 2010 @01:58PM
(#2056094)
It's at times like this that I feel really stupid ;) Thanks, you can guess what I'll be changing on my sites the minute I sobered up, err, sometime in the next couple of days ;)
That said, I'm open to the idea that I'm being extremely foolish about this ;)