v145 · Web APIs · LNA Permission Demo

LNA Permission Demo

Queries the browser's Permissions API for local network access state, showing whether Chrome 145+ split permissions are available and what state each address space permission is in.

The local-network-access permission name is available in Chrome 145+. Querying it returns granted, denied, or prompt for the current site's access to private network ranges.

permission states

Permissions APINot checked
local-network-access
permission change events

code

// Query local network access permission (Chrome 145+)
async function checkLnaPermission() {
  if (!navigator.permissions) {
    console.log('Permissions API not supported');
    return;
  }

  try {
    const status = await navigator.permissions.query({
      name: 'local-network-access',
    });

    console.log('LNA state:', status.state);
    // 'granted' | 'denied' | 'prompt'

    // Watch for changes (e.g. user revokes in settings)
    status.addEventListener('change', () => {
      console.log('LNA state changed to:', status.state);
    });
  } catch (err) {
    // 'local-network-access' not recognised in older browsers
    console.warn('LNA permission not supported:', err.message);
  }
}

checkLnaPermission();

when the prompt appears

// The user sees a permission prompt when:
// 1. A public page fetches a URL in a private address space
// 2. The target server responds with Access-Control-Allow-Private-Network: true
// 3. The permission state is 'prompt' (not yet granted/denied)

// Example: fetching a local device API
fetch('http://192.168.1.1/api/info')
  .then(r => r.json())
  .then(data => console.log(data))
  .catch(err => {
    // Failed if:
    // - Server lacks Access-Control-Allow-Private-Network header
    // - User denied the permission prompt
    // - No preflight response
    console.error(err);
  });

// Chrome 145 split permissions mean:
// Granting access to 192.168.x.x does NOT auto-grant localhost access.

see also