14

I am doing a page speed optimization for my website and studying how other websites do it. I noticed that some websites such as as Facebook or Ringgitplus show 0 bytes for some of their resources in Chrome's developer tools, Network tab, while the real content size is several kilobytes.

The screenshot of Network tab showing 0 bytes for some resources

I read some articles that says that size is the amount being fetched and content is the actual size of the response. So when size is 0 bytes, it means it served from cache. But the same thing happened when I open the page using Incognito or clearing all my cache.

How is this possible and how can I achieve the same thing for my websites?

5
  • 2
    and if you do a ctrl+F5 (a cache bypassing reload) Sep 17, 2013 at 13:21
  • 1
    Have you profiled your page using developer.yahoo.com/yslow yet?
    – Marcel
    Sep 17, 2013 at 14:06
  • @ratchetfreak It still the same. Sep 17, 2013 at 15:49
  • @Marcel Yes, I am using several tools such as the one you mentioned, Google Page Speed, as well as webpagetest.org Sep 17, 2013 at 15:50
  • Doesn't really answer the questions of why the uncached resrouces could possibly show 0b, but here's a good SO question which addresses the difference: stackoverflow.com/questions/8072921/…
    – Ben Lee
    Sep 23, 2013 at 22:34

1 Answer 1

4

Understanding Chrome's behavior is easiest to see in a site that supports both http and https.

If you open Developer Tools and view this image, then Chrome reports 27.1k if the image is cached and 257 bytes if it is not. You can clear your cache inside Developer Tools by right-clicking on the area on the bottom of the screen (for example next to nav_logo161.png).

Now open the link with https. Chrome reports 0 bytes whether the item is cached or not. If it is cached you get a 304, and if it is not cached you see a 200 status. But you can see in the latency that the uncached response takes much longer.

So, long story short, if you want Chrome to report 0 bytes for your web-page use https.

This bug is recorded here and here.

This bug is noticeable primarily when viewing images. The reason you notice it with the http links in the original post is that both sides actually render in https.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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