Web APIs

Cache.prototype.match()

Try the free JavaScript compiler

Looks up a matching cached response, resolving to undefined if none matches.

Formal Syntax & Structure

javascript syntaxjavascript
cache.match(request, [options])

Parameters & Attributes

NameTypeDescription
requestRequest | stringRequest or URL to match.
optionsobjectOptional matching controls.

Return Value

Promise<Response | undefined>

Looks up a matching cached response, resolving to undefined if none matches.

Working Example

Example Snippetjavascript
(async () => {const name="bm-v14-"+crypto.randomUUID();try{const c=await caches.open(name);console.log(String(await c.match(new URL("v14-missing",location.href).href)));}finally{await caches.delete(name);}})()
JavaScript Reference