How to detect internet connectivity in cordova?


I already tried cordova network plugin but problem is that wifi is connected but internet is not available. cordova api is showing wifi is connected. How i can detect that internet is not available even if wifi is connected?

Any help would be highly appreciated.