Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter cached requests in chrome devtools?

Tags:

Background

Chrome devtools "Network" tab has the option to filter requests based on string-match of the URL and some predefined content type filters (CSS/JS/...). If you set a filter, the bottom bar of the network tab, contains extra information related only to the matching filter.

Question

Is it possible to filter requests if they were served (or not) by browser cache?

Usecase

If someone has an alternate approach to do this:

I would like to measure the "real" request-count/transferred-size of my HTML-UI. The bottom of the network tab already contains the transferred-size properly, however the request-count contains the cached requests also.

I could use wireshark/tcpdump however, the HTML-UI could request resources from other domains, maybe I could write a complicated filter, however this seems a normal use-case.

like image 258
p1100i Avatar asked Dec 07 '15 09:12

p1100i


People also ask

How do I filter API calls in Chrome developer tools?

Simply go to the page and open the network tab. You can see the network tab by hitting cmd + opt + j on your Mac or ctrl + shift + j in Windows. It will open up the console tab in DevTools by default. Once the console tab is open, simply click on the network tab to make it visible.

How do I see Chrome requests?

In Chrome, visit a URL(such as https://www.google.com ), right click, select Inspect to open the developer tools. Select Network tab. Reload the page, select any HTTP request on the left panel, and the HTTP headers will be displayed on the right panel.

How do I see DevTools requests?

Right click -> inspect -> then you will have the chrome dev tools just by selecting networks you can filter what's the browser is loading also you can see the http request going through your application.


2 Answers

You can use a filter of larger-than:1 to hide all requests that returned less than 1 byte. When I tested this, requests served from the cache have (from cache) in the size column and are excluded by this filter. Negating it showed only cache cached requests.

Granted, this will also exclude/include 0B responses from the server. If that's a concern, you might be able to add mimetype or status code filters to achieve your aims, depending on the exact responses.

like image 126
John Neuhaus Avatar answered Sep 23 '22 03:09

John Neuhaus


You can filter requests served from either the browser disk or memory caches using the is:from-cache query. This can be negated using the query -is:from-cache.

like image 34
Matt Dunn Avatar answered Sep 20 '22 03:09

Matt Dunn