Carlo
Carlo

Reputation: 155

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

Upvotes: 1

Views: 1645

Answers (2)

Simone Vicentini
Simone Vicentini

Reputation: 269

I think drublic is correct. It seems like you are opening that page from local disk and not through a webserver.

And if you don't specify the protocol(scheme) in a linked resource, the browser will use the same protocol as the hosting page. So using //ajax.googleapis.com... is correct and there is no need for special scripts to infer the protocol to use.

here is a related stackoverflow question

which points to this blog post

Upvotes: 0

Cory
Cory

Reputation: 604

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

Upvotes: 4

Related Questions