Neo
Neo

Reputation: 397

Firefox doesn't load jquery from ajax.googleapis.com

I have Firefox 20.0.1, and the following code that I use in my page:

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<!--<script src="js/lib/jquery/jquery-1.10.2.min.js"></script>-->

When I run my page on chrome, opera, safari and IE, everything works perfect, but when I try to run it on Firefox console throws me this error:

[13:14:27.848] ReferenceError: $ is not defined

And when I uncomment the second line for load it localy it works perfectly.

I also tried with http:// instead of // with no luck. It's weird, jQuery is also the first script that my page has to load. Any suggestion?

Upvotes: 2

Views: 1654

Answers (1)

Neo
Neo

Reputation: 397

Fixed, the issue was the next:

In my htaccess file I had a X-Content-Security-Policy restriction that didn't specified that the server could load external content from ajax.googleapis.com, so the line was:

Header set X-Content-Security-Policy "allow 'self';"

So in order to make it work I had to replace it with:

Header set X-Content-Security-Policy "allow 'self'; script-src 'self' ajax.googleapis.com;"

And case closed! =) Special thank's to A. Wolff for the suggestion..

Upvotes: 4

Related Questions