[w3c/ServiceWorker] Requests from <object> elements are not intercepted (Issue #1799)

d3lm created an issue (w3c/ServiceWorker#1799)

I noticed that requests made via `<object data="...">` do not appear to be intercepted by a Service Worker. Fetch events for these requests never fire, even though other requests (e.g. `<img>`, `fetch()`, `<iframe>`) to the same origin are handled as expected.

Is this the expected behavior per spec, or is it a browser-specific limitation / bug?

### Reproduction

1. Register a simple Service Worker that logs all `fetch` events.
2. Create an HTML page with an `<object>` tag pointing to a same-origin resource.
3. Observe that the SW never receives the `fetch` event for that request.

### Minimal Example

`index.html`
```html
<!DOCTYPE html>
<html>
  <body>
    <script>
      navigator.serviceWorker.register("sw.js").then(() => {
        console.log("SW registered");
      });
    </script>

    <p>Below is an object that loads a same-origin resource:</p>
    <object data="test.txt" type="text/plain" width="200" height="100"></object>
    <iframe src="iframe.html"></iframe>
  </body>
</html>
```

`sw.js`
```js
self.addEventListener("install", (event) => self.skipWaiting());
self.addEventListener("activate", (event) => self.clients.claim());

self.addEventListener("fetch", (event) => {
  console.log("SW fetch:", event.request.url);
});
```

`test.txt`
```text
Hello from test.txt
```

`iframe.html`
```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>IFrame</title>
  </head>
  <body>
    IFrame loaded
  </body>
</html>
```

If you run this example you'll see this in the console:

```
(index):6 SW registered
19:37:09.337 sw.js:5 SW fetch: http://localhost:3000/iframe.html
19:37:09.593 sw.js:5 SW fetch: http://localhost:3000/iframe
```

Notice how the `test.txt` request is not showing up and doesn't seem to be intercepted.

Am I right to assume that Service Worker `fetch` should intercept all same-origin requests, including `<object>`?

This is the case for both Chrome and Firefox.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/issues/1799
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/issues/1799@github.com>

Received on Tuesday, 21 October 2025 17:41:10 UTC