Is it possible to detect the Android captive portal browser? Is it possible to detect the Android captive portal browser? google-chrome google-chrome

Is it possible to detect the Android captive portal browser?


You can use Modernizr to detect the existence of the Fetch API or Local Storage features, both of which exist in regular Google Chrome and Firefox, etc but aren't available in the captive portal browser.


The Pixel devices I'm testing on now pass both these tests -

try {    const test = 'test';        localStorage.setItem(test, test);    localStorage.removeItem(test);    sessionStorage.setItem(test, test);    sessionStorage.removeItem(test);    alert("We're in a chrome instance!")} catch(e) {    alert("We're inside a Captive Portal!")}

Running on Android 10 - Pixel XL and regular Pixel

For a lot of other devices - the above localStorage test works fine - we go into a catch block and determine that we are not inside a full fledged Chrome tab/Android Default browser tab, but Android has changed the way it runs captive portal it seems.