Search code examples
jquerygoogle-chromemodernizrhtml5boilerplate

Chrome issue with Modernizr and jQuery


I'm working on HTML5 Boilerplate template and Modernizr. While testing some features, I tried to put in action some polyfills. Ok, everything seems to work well, but Chrome get an error: it seems to try loading jQuery imediately after Modernizr, even if It shouldn't! In fact there is no script tag below Modernizr... What is Chrome doing?

The image shows Chrome Dev Tools


Solution

  • It's because you're loading //ajax.googleapis.com.

    It needs to be either http: or https:

    Then it will work locally.

    I'm currently trying to figure out an automatic way around this. Like... if https capable then https: else http:

    Solution: Ok, you can either write a JS one-liner ternary to detect the file: protocol, then assign https: or http:, or you can simply run your site through a server like WAMP or something and it will detect the protocol.

    https://github.com/h5bp/html5-boilerplate/blob/master/doc/faq.md