Codesnipp.it Social Code Sharing

Germán Toro del Valle

Loading Javascript library from CDN with local backup

by Germán Toro del Valle on Jul 26, 2011

<html> 2 <head> 3 <!-- Grab Google CDNs jQuery; fall back to local if necessary --> 4 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"> 5 </script> 6 <script> window.jQuery || document.write(unescape('%3Cscript src="/js_folder/jquery-1.6.1.min.js"%3E%3C/script%3E')) 7 </script> 8 </head> 9 <body> 10 Hi! 11 <script type="text/javascript"> 12 $(document).ready(function() { 13 alert("I am here"); 14 }); 15 </script> 16 </body> 17 </html>

Can't see the comments? Please login first :)