Consider using GNOME's captive portal handling
This is implemented via the “connectivity” feature, see e.g.
contrib/fedora/rpm/20-connectivity-fedora.conf in NM’s Git tree to see what kind of parameters it can take: basically, it just calls home via a HTTP request, and checks if it gets the expected response — see
NetworkManager.conf(5) for details.
It also seems that another component of this feature (the “login agent”) was implemented in GNOME Shell (see https://bugzilla.gnome.org/show_bug.cgi?id=609870, that gives a little bit more details); see e.g.
grep -iE (connectivity|portal) in Jessie’s GNOME Shell source => we should have a close look there too. Frederic Peters wrote that “Up in the stack GNOME Shell will automatically popup a window embedding a webkit widget set on the given URI (and thus, displaying the captive portal)”.
Copied to Tails -