In this post, we will learn how to check browser is online or offline with JavaScript. How we can detect browser online or offline, we will learn in this post.


How To Check Browser Is Online OR Offline With JavaScript ?


Check Browser Is Online OR Offline

To check browser is online or offline, we use online property of the navigator object. It returns a Boolean value that specifies if browser is online of offline.


<script>

if(navigator.onLine) {
console.log('Browser is Online');
} else {
console.log('Browser is Offline');
}

</script> code-box



Summary

In this post we learned how to check browser is online or offline with JavaScript. You try to make it yourself. I hope you make. If you face any problem, then comment and tell us. Keep visiting the blog to read more similar posts.

Post a Comment

Previous Post Next Post