captivePortal

Determine the captive portal state of the user’s connection. A captive portal is a web page displayed when a user first connects to a Wi-Fi network. The user provides information or acts on the captive portal web page to gain broader access to network resources, such as accepting terms and conditions or making a payment. 

To use this API you need to have the "captivePortal" permission.

Properties

captivePortal.canonicalURL
Return the canonical URL of the captive-portal detection page. Read-only.

Functions

captivePortal.getLastChecked()
Returns the time, in milliseconds, since the last request was completed.
captivePortal.getState()
Returns the portal state as one of unknown, not_captive, unlocked_portal, or locked_portal.

Events

captivePortal.onConnectivityAvailable
Fires when the captive portal service determines that the user can connect to the internet.
captivePortal.onStateChanged

Fires when the captive portal state changes.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxOperaSafariFirefox for Android
canonicalURLChrome No support NoEdge No support NoFirefox Full support 72Opera No support NoSafari No support NoFirefox Android No support No
getLastCheckedChrome No support NoEdge No support NoFirefox Full support 68Opera No support NoSafari No support NoFirefox Android No support No
getStateChrome No support NoEdge No support NoFirefox Full support 68Opera No support NoSafari No support NoFirefox Android No support No
onConnectivityAvailableChrome No support NoEdge No support NoFirefox Full support 68Opera No support NoSafari No support NoFirefox Android No support No
onStateChangedChrome No support NoEdge No support NoFirefox Full support 68Opera No support NoSafari No support NoFirefox Android No support No

Legend

Full support  
Full support
No support  
No support