MDN wants to learn about developers like you:

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The has() method of the CacheStorage interface returns a Promise that resolves to true if a Cache object matches the cacheName.


caches.has(cacheName).then(function(boolean) {
  // true: your cache exists!


a Promise that resolves to true if the cache exists or false if not.


A DOMString representing the name of the Cache object you are looking for in the CacheStorage.


The following example first checks whether a cache called 'v1' exists. If so, we add a list of assets to it. If not (meaning the has() promise would reject) then we run some kind of cache set-up function.

caches.has('v1').then(function(hasCache) {
  if (!hasCache) {
  } else {'v1').then(function(cache) {
      return cache.addAll(myAssets);
}).catch(function() {
  // Handle exception here.


Specification Status Comment
Service Workers
The definition of 'CacheStorage' in that specification.
Working Draft Initial definition.

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 40.0 (Yes) 44 (44)[1] No support ? No support
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support No support 44.0 (44) (Yes) (Yes) (Yes) 40.0

[1] Service workers (and Push) have been disabled in the Firefox 45 & 52 Extended Support Releases (ESR.)

See also

Document Tags and Contributors

 Contributors to this page: erikadoyle, PaulKinlan, chrisdavidmills, tarjei, jpmedley, kscarfone
 Last updated by: erikadoyle,