Forum Posting Basics

Using a CDN for external libraries

If your page uses the jQuery library, then link to the appropriate CDN hosted version.

E.g. don’t write this:

<script type="text/javascript" src="./js/jquery.min.js"></script>

Write this:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>

The same goes for other external libraries or plugins. You should either link to them on your server (using a full URL), or use a CDN such as http://cdnjs.com/

E.g. don’t write this:

<script type="text/javascript" src="./js/html5shiv.js"></script>

Write this:

<script type="text/javascript" src="http://mydomain.com/js/html5shiv.js"></script>

Or this:

<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2/html5shiv.js"></script>
2 Likes