Service worker in Isolated Web Application (IWA)

495 views
Skip to first unread message

Sez Ibraim

unread,
Feb 5, 2025, 10:59:59 AM2/5/25
to Chromium-dev
I am trying to build IWA with custom service worker file. In custom service worker file I am using CacheAPI to cache resources. But when I built my application there were errors that "failed to execute .add method or .put method and request scheme isolated-app is unsupported. I asked gpt and it says that CacheAPI does not support isolated:app protocol and it recommends to use indexeddb for caching resources instead of czcheAPI. Is it true because I cannot find any other source about this topic?

Reilly Grant

unread,
Feb 5, 2025, 1:14:04 PM2/5/25
to sezi...@gmail.com, Chromium-dev
I don't think there's any reason why we couldn't add support for caching resources on an isolated-app:// origin but why are you caching sources at all? All of your IWA's resources come from the Web Bundle which is already stored locally (essentially pre-cached).
Reilly Grant | Software Engineer | rei...@chromium.org | Google Chrome


On Wed, Feb 5, 2025 at 7:57 AM Sez Ibraim <sezi...@gmail.com> wrote:
I am trying to build IWA with custom service worker file. In custom service worker file I am using CacheAPI to cache resources. But when I built my application there were errors that "failed to execute .add method or .put method and request scheme isolated-app is unsupported. I asked gpt and it says that CacheAPI does not support isolated:app protocol and it recommends to use indexeddb for caching resources instead of czcheAPI. Is it true because I cannot find any other source about this topic?

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/3abae8b3-d411-4798-8fa8-4d9455a6e821n%40chromium.org.

Sez Ibraim

unread,
Feb 5, 2025, 2:06:08 PM2/5/25
to Chromium-dev, Reilly Grant, Chromium-dev, sezi...@gmail.com
I am trying to cache media items which I get them from API request. Then I am displaying them in html file. For example I get url link for a media like https://domain.com/Image/item1.png and I cache that media. So if there is no internet connection the cached media will still continue to display. This is my purpose why I want to use service worker and caching. In PWA it is working.

guest271314

unread,
Feb 6, 2025, 10:07:59 AM2/6/25
to Chromium-dev, Sez Ibraim, Reilly Grant, Chromium-dev
One option is to use navigator.storage.getDirectory() then write to the Origin Private File System, which writes created directories and files to the Chromium configuration folder - without prompting user for permissions. Technically it is possible to read that data with user defined means outside of Chromium. Or, use WICG File System Access and write the directories and files to the user file system with prompting the user.

Claudio Klemp

unread,
Feb 6, 2025, 12:57:45 PM2/6/25
to Chromium-dev, Sez Ibraim, Reilly Grant, Chromium-dev
A unusual solution for you : 

Cache it in the DOM. Instead of indexDB, session storage, etc , the resources you have from the APIs.

Create a domStorage ( chatGPT can help you in this ) for put , get, delete, list ... less than 100 lines of javascript. Store the items, whatever it is in a DIV or different DIV's , retrieve and / or cancel the content of the DIV.

under http://egittoturismo.com you can find such a usage under "const domStorage = {...}" so you have a better idea.

Hope it can be useful to you.

Claudio.

Robbie McElrath

unread,
Feb 7, 2025, 7:55:10 PM2/7/25
to Chromium-dev, Claudio Klemp, Sez Ibraim, Reilly Grant, Chromium-dev
It's failing due to the check here, and we should fix that. I filed a bug to track this, but in the meantime alternative storage APIs like OPFS or indexedDB are probably your best option.

Matthew Hunt

unread,
Jul 10, 2025, 9:36:12 AM7/10/25
to Chromium-dev, Robbie McElrath, Claudio Klemp, Sez Ibraim, Reilly Grant, Chromium-dev
Hi,

Are you able to share the link to the bug/issue that was raised for this for tracking purposes? We have run into the same issue and could really do with support for the CacheAPI in an IWA.

Thanks

This document and any attachments to it contain information that is private and confidential and should only be read by those persons to whom they are addressed. No person, without subsequent written confirmation of their contents, should rely upon the contents of this e-mail. This e-mail and the information it contains are supplied in good faith but Remote Media shall not be under any liability in damages or otherwise for any reliance that may be placed upon them by the recipient.


Any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail is strictly prohibited save unless expressly authorised by the sender. Signagelive is a registered trademark of Remote Media Group Limited which is registered in England and Wales under number 3924279.


For more information, please see our Privacy Policy or GDPR information page.

Robbie McElrath

unread,
Jul 11, 2025, 11:59:22 AM7/11/25
to Matthew Hunt, Chromium-dev, Claudio Klemp, Sez Ibraim, Reilly Grant
Unfortunately the bug is internal, but doesn't have anything interesting in it at the moment. There was a CL to implement this, but it was abandoned with the argument that caching IWA content doesn't make sense as the resources are all local anyway.

Out of curiosity, what is your use case for the Cache API?
Reply all
Reply to author
Forward
0 new messages