I have my domain, abc.com, and an iframe inside my page 123.com. I own the code for each domain.
With a service worker I can load abc.com while offline but my iframe for 123.com does not load, even if I add its files to my cache.addAll call.
How can I get my iframe to render while offline? Examples welcome.
<!DOCTYPE html>
<html>
<head></head>
<body>
will render offline
<!-- will not render offline -->
<iframe src="123.com"></iframe>
</body>
</html>
Loading an <iframe> is very similar to loading a full page in a new tab/window. The request for the <iframe>.src will trigger any fetch handlers on a service worker whose scope covers the <iframe>.src, i.e. in your case, a service worker whose scope covers https://123.com/.
The FetchEvent that's passed to the fetch handler will have a request.mode of 'navigate', just like a navigation to a new page in a standalone tab/window would have.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With