Learn how to detect whether the browser is online or offline with JavaScript.
The onLine
property of the Navigator
object returns a Boolean value that specifies whether the browser is in online or offline mode:
Find out whether the browser is online:
var x = "Is the browser online? " + navigator.onLine;
Try it Yourself »
Read more about the Navigator Object in our JavaScript Navigator Tutorial.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!