network check in javascript