Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

One of the recommendations from web performance optimization services is to minimize DNS look ups.

I fully understand why they recommend this but why not just point references to external files to the IP address?

For example:

<script src="//555.555.55.55/cdn/jquery.min.js"></script>

I have never seen this done, and my searches here came up empty, why not?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

Just to clarify the question to prevent confusion: It's advised by Google to reduce the number of lookups for unique hostnames - see: Minimize DNS lookups

As indicated there, hostnames are cached in the client's browser and OS. Using an IP address instead of a hostname for files hosted on the same host would therefore not be of benefit.

For files hosted elsewhere, you shouldn't use an IP address because they can change, whereas hostnames will not. For files hosted on a CDN like jQuery, a range of IP addresses will most certainly be used for redundancy, load balancing, etc... Reaching a busy server or incorrect IP address would result in any code running the library to no longer function.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.