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…

What each state means for a background fetch to a local address
statewhat a background fetch doeswhat 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.

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.

Queried on this origin, just now
permissionstate

see also