So the javascript used to work on my github pages site but it doesn't work anymore after I delete the repository and tried to re-uplaod the project with some changes. Here is the repo. Here is the site.
<!-- wrong -->
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
Replace http
with https
and you should be good to go. This error is easily discoverable if you open the Javascript Console in your browser (usually under F12).
<!-- correct -->
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
You could also use this once-popular syntax:
<!-- meh -->
<script src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
but it's cargo cult at this point. Spelling out https://cdnjs.cloudflare.com/
is better.
Here's why:
file://
URI, which is sometimes helpful during development.Some advice from Paul Irish, one of developers behind Chrome:
If the asset you need is available on SSL, then always use the
https://
asset.It’s always safe to request HTTPS assets even if your site is on HTTP, however the reverse is not true.