How can I tell when a web page resource is cached?

There isn't a JavaScript API for checking if a resource is cached. I think the best you can do is check how long it took to load the resources, and bucket the ones with shorter load times together At the top of the page: script>var startPageLoad = new Date().getTime(); Gif var barProbablyCached = barLoadTime.

There isn't a JavaScript API for checking if a resource is cached. I think the best you can do is check how long it took to load the resources, and bucket the ones with shorter load times together. At the top of the page: On each resource: When reporting load times: var fooProbablyCached = fooLoadTime Gif var barProbablyCached = barLoadTime.

Thanks, Annie. That makes perfect sense. Some browsers are weird when you mix script blocks and loading external resources, so this may impact parallel downloads; I'll try it and see.

– William Pietri Mar 2 '10 at 23:46 looking at browserscope, it looks like what you want to watch out for is a stylesheet immediately followed by an inline script: browserscope. Org/? V=top&category=network (The other parallel download issues all apply to external scripts).

– Annie Mar 3 '10 at 0:17.

You need a plug-in to do this. Firebug can tell you on the "NET" tab, once you install it (for Firefox). JavaScript itself cannot see the browser's HTTP traffic.

As I mention in the question, I'm doing client-side instrumentation on real pageviews. It is unlikely that I will get a lot of our users to install Firebug, especially the ones who don't use Firefox. – William Pietri Mar 2 '10 at 23:22 1 Not liking the truth is no reason for a down-vote.Thanks.

:( – Diodeus Mar 2 '10 at 23:24 Your answer could be fine on a different question, but it's unhelpful here. Making sure the most helpful answer is at the top of the page seems a reasonable use of up- and down-voting to me. – William Pietri Mar 2 '10 at 23:30.

We're instrumenting a fraction of our client-side page views so that we can get better data on how quickly pages are loading for our users. The first time users arrive on our site, a number of resources (JS, CSS, images) are cached by the browser, so their initial pageview is going to be slower than subsequent ones. Right now, that data is mixed together, so it's hard to tell an initial page load from a subsequent pageview that's slow for some other reason.

I'd love a cross-browser way to check to see whether the cache is already primed, so that I can segregate the two sorts of pageview and analyze them separately.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions