2

I have a custom CMS, and for some reason jQuery will not load from the CDN. After sitting on this for days, I remember I made a change the the .htaccess file but not sure if it's really the cause.

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php|themes|assets|images|coobie|robots\.txt)
RewriteRule ^ index.php [QSA,L]

Would this prevent:

<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>

from loading? The site is on my local computer, so it's requested form https://localhost

How I know jQuery is not loading: When I check the dev tools in Safari it's not listed in the scripts that are loaded. Also my scripts that were working, now log '$' is undefined. The link works fine if I head to it, so something is stopping it.

  • Remove it and find out. – Ken Sharp Feb 20 '16 at 18:29
2

You're trying to load a HTTP resource on a HTTPS page. Your browser may be blocking this external resource because it's considered insecure on an otherwise "secure" page.

Change src="http://code.jquery.com/jquery-2.1.4.min.js" to src="https://code.jquery.com/jquery-2.1.4.min.js" and see if that helps.

  • 1
    Can't believe I missed that one! Both answers are correct. So no offense to @Vasilis that I marked this one correct. – Richard Testani Feb 20 '16 at 21:20
4

Remove "http:" from the script src url, like:

<script src="//code.jquery.com/jquery-2.1.4.min.js">  

In case the problem insists, check if shows errors through Chrome Dev Console and paste it here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.