Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Jquery API ping?

Tags:

html

jquery

If I use Googles Jquery load script inlink, then if the user has the file already in their cache, will the users computer still contact Google in ANY way when the page loads?

Example:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script>
like image 688
David19801 Avatar asked May 10 '26 00:05

David19801


1 Answers

Depending upon the cache settings of the browser, the cache headers sent by the server when the file was originally loaded, and the time since the file was last loaded, the browser may still issue the request with a If-Modified-Since HTTP header - which would result in a HTTP 304 "Not Modified" response if the file was not modified server-side since it was originally received by the browser / client.

The HTTP headers being returned by Google for this URL are a bit interesting, though its been a while since I've had to deal with the specifics of this:

$ curl -i http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: text/javascript; charset=UTF-8
Last-Modified: Thu, 10 Nov 2011 18:58:43 GMT
Date: Wed, 30 Nov 2011 15:18:56 GMT
Expires: Wed, 30 Nov 2011 15:18:56 GMT
X-Content-Type-Options: nosniff
Server: sffe
X-XSS-Protection: 1; mode=block
Cache-Control: public,max-age=31536000
Age: 518244
Transfer-Encoding: chunked

The Date, Last-Modified, and Expires are all in the past - so I read this to mean that it expires immediately. Yet, there are Cache-Control and Age headers which should allow this to be cached for 1 year (31536000 seconds) - if http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 is being followed as required.

like image 99
ziesemer Avatar answered May 12 '26 16:05

ziesemer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!