I did a wireshark dump on my Ubuntu 18.04 laptop and noticed that both Firefox and Ubuntu do captive portal detection. Of the two, I think the Firefox method is simpler to implement and use.
Firefox does an HTTP GET on http://detectportal.firefox.com/success.txt
Responds with HTTP 200 OK with a Content Type of text/plain and a body of “success\n”
Ubuntu does an HTTP GET on http://connectivity-check.ubuntu.com
Responds with HTTP 204 and a header of X-NetworkManager-Status: online\r\n
Notice that captive portal detection uses an unencrypted transport — http, and not https.