Just starting a new HTML5 project and using modernizr.js
I noticed on the modernizr docs page it says you can use the following:
Modernizr.load([
  {
    load: '//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js',
    complete: function () {
      if ( !window.jQuery ) {
            Modernizr.load('js/libs/jquery-1.6.1.min.js');
      }
    }
  }
]);
So in my HTML I have this:
<script src="scripts/modernizr-2.0.6.js"></script>
<script>
Modernizr.load([
    {
        load: 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js',
        complete: function () {
            if ( !window.jQuery ) {
                        Modernizr.load('scripts/jquery-1.6.1.min.js');
            }
        }
    }
]);
</script>
But looking at firebug, no jquery is loading.
Am I missing something obvious here?
Cheers, Adi
Modernizr is a small lib and it gets loaded and executed quickly and yes, it will load scripts in parallel, so good idea to use it. About your error, remove the https: from the url and try as in the example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With