Check internet connection (and not only if we are connected through wifi)

Hello people!

I wrote a week ago since I had a problem with my application, thanks to the community help the development of the app I was working with a bunch of friend is now going smoothly :slight_smile:

We’re actually having a different kind of problem: we need to check the internet connection of the phone. We’re trying to use the ngCordova network plugin, but the only thing that we can obtain is if we’re connected to a WiFi or 3G network, but in case of the Wifi connection we’re unable to understand if we actually have an internet connection or if we’re behind some sort of “captive portal” waiting for the authentication.

What we tried was to use the ngCordova plugin ( and to disabling the ADSL connection of the wireless router we’re using by disconnecting the cable, but being connected to the wireless router, the isOnline() function returns true even if the internet is unreachable.

Is there any (easy) way to solve this annoying problem?

Many thanks in advance :slight_smile:

may be you will send some remote request and if it will have 404 status code - there is no internet at all)))

You can test this snippet, it returns an IP address if there is a connection

var json = ‘’;
success(function(data, status, headers, config) {
// this callback will be called asynchronously
// when the response is available
error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.