How to check Internet connection without plug-in?


I want to check internet connection inside my app but its plugin is working with special versions so i started to think how can I do this? i find this code from this page
export class LoginPage {
public onlineOffline: boolean = navigator.onLine;

  constructor(public navCtrl: NavController, public navParams: NavParams) {
    window.addEventListener('online', () => {this.onlineOffline = true});
    window.addEventListener('offline', () => {this.onlineOffline = false});


  ionViewDidLoad() {
        console.log('ionViewDidLoad LoginPage');

but it seems it check only network connectivity not internet connectivity.