JS library like JQuery could be linked from other site (e.g. google). Usually I personally use

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

However I may use

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

or similar.

I love to take full treatments for my website, and so i make use of the first way. But using google or any other host has some advantage (i.e. decreased latency, elevated parallelism, better caching). Have advantage and disadvantage. What must i use? That which you use and why?

Please tell me your opinion.


I believe it is dependent about the audience of the website.

If your internet site is public facing the ones will be being able to access it mainly or solely from the web then you will take advantage of lower bandwidth utilization, faster reactions and caching benefits since the probability of the file getting been formerly recommended and loaded from another website is high.

If your internet site is internal to have an intranet you might encounter issues of people don't have access to the internet but you are also likely to be wasting bandwidth since you are delivering everybody out on the internet to fetch personal files you can host in your area.

I personally use Google where feasible for performance reasons, however i also sign in an area copy just in case I have to work on the website after i am offline, e.g., with an plane, or in a remote location without any access to the internet.

Remember that if you are using a duplicate from google (or whomever), you need to guard against the chance that they may move or alter the file, or that they are server may be lower.

In case your site requires a specific javascript library, then you definitely should download it and serve up yourself. In case your earnings is dependent on that file, the final factor you would like would be to depend on another site to supply it.