Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDon Shipley
19,488 PointsJQuery
In the video it shows how to copy the CDN and paste it in your HTML. On the video the link has Http:// yet the new JQuery site the link is missing the Http;. using notepad ++ and Google Chrome the link does not work unless you add the Http: am I doing something wrong when copying and pasting the link?
Video shows on JQuery site <script src="http://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
http://jquery.com/download/ shows <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
6 Answers
Andrew Chalkley
Treehouse Guest TeacherHey Don,
This question comes up a bit in the forum so I thought I'd make a video on explaining the pitfalls of including jQuery in modern web development. The URLs that start with //
are known as Protocol Relative URLs or sometimes Protocol-less URLs.
Hope this clarifies things for you and others.
Regards,
Andrew
Jonathan Rawlins
13,998 PointsThis is because the browser see's "//code.jquery.com/jquery-1.11.0.min.js" as a link to a file on your system, if you are wanting to copy and paste the jquery file into your filesystem for use on your site, use the http:// infront like this: "http://code.jquery.com/jquery-1.11.0.min.js" copy the code and paste it into a file called "jquery-1.11.0.min.js" granted it can be called whatever you want it to be called.
The above jquery file example was just the first link that I came to so please pick the version that you require. 2.0.x is available too although does ignore some of the older browsers and sometimes best to stick to 1.10.x generally.
You could also drop this into your page and load from a CDN:
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
Hope this helps.
Tibor Szalay
Courses Plus Student 5,754 PointsJust to add because it might be useful to some: Another pitfall which I can think of but occurs much rarer is when you are creating content for a company which accesses the internet site via a proxy, in few cases the library load time of the given CDN increases significantly. This error can be nailed down very difficult as it usually occurs at random, but removing the CDN and including the file on the server solves the problem.
David Endersby
24,915 PointsThanks Andrew . Very insightful. :-)
Don Shipley
19,488 PointsThank you Andrew, I should have realized it was looking for the file on my machine. I do have wamp on my machine so rather than opening the html from notepad++ I opened it up from my localhost removing the http: . Works fine, also see your point on the https:
Aamnah Akram
17,549 PointsFaced the same issue with Bootstrap CDN links, now i know why that happened. Thanks Andrew for the video, i feel like i know a secret.
Ben Goldman
14,626 PointsThanks, Andrew. That video solved my problem. I'd like to suggest that Treehouse append this information to the JQuery Basics course. It could really help a lot of people.