Web APIs
Cache.prototype.match()
Looks up a matching cached response, resolving to undefined if none matches.
Formal Syntax & Structure
javascript syntaxjavascript
cache.match(request, [options])Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| request | Request | string | Request or URL to match. |
| options | object | Optional 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);}})()