MDN self-hosted library · e01.org
onStateChanged / notebook

onStateChanged

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
function handlePortalStatus(portalStatusInfo) {
  console.log(`The portal status is now: ${portalStatusInfo.details}`);
}

browser.captivePortal.onStateChanged.addListener(handlePortalStatus);