browser-is-online Check the network connection Usage const isOnline = require('browser-is-online'); isOnline((err, status) => { if (err) throw err; changeText(status);}); License MIT © Vivek Poddar