Correct jQuery

The Correct Way (yes, that’s capitalized) to reference is by CDN. ¬†For more information on a Content Distribution Network, Google (yes, that’s capitalized) it. That’s not why we’re here.


<script src="//code.jquery.com/jquery-2.1.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" />

This is the Correct Way not only because of the use of a CDN, but because of the lack of a specified protocol. Rather than specify “http://” or “https://”, it simply uses “//” and the protocol is not specified. This will remove the noise that is sometimes encountered about “viewing insecure content over a secure network.”

I’ve also included the jQuery UI library and a supporting theme. Because you don’t think you’ll need it, but you will.

Feel free to bookmark this page. You’ll be back.

Leave a Reply

Your email address will not be published. Required fields are marked *