v154 · lna + background fetch
The permission, before you ask
A service worker cannot show a permission prompt. So for a background fetch to a local address, the grant has to exist before the fetch is registered — which makes querying the state, from the page, the first thing your code should do.
This origin's local-network permission
Querying…
| state | what a background fetch does | what your code should do |
|---|
permissions.query() never prompts — it reports. That is what makes it safe to call on load and to branch on before you have asked the user for anything, which is exactly the shape this feature needs.
Related permission states, for comparison
Not every permission name is queryable in every browser, and an unrecognised name throws rather than returning a state. The rows here are the real result of asking.
| permission | state |
|---|