Asnau Nauticas
Asnau Nauticas

Reputation: 346

How to clear Network Cache using JavaScript without refreshing page

I am using setInterval to call Rest API's from my web page in about every 60 seconds. Now it is making request and hogging Network with too much request due to which after sometime my page becomes slow and non-responsive.

Can anyone help me out about how to clear Network Tab cache in Dev tools without refreshing page. P.S. I don't want to clear all of Cache just the Network cache after 5 min.

Upvotes: 2

Views: 2538

Answers (1)

Vikas
Vikas

Reputation: 7165

You cam use caches.delete(cacheName).

caches.keys().then(function(names) {
    for (let name of names)
        caches.delete(name);
});

But it is not supported in IE. For more details and browser supports, check here

Upvotes: 1

Related Questions