Once and for all, what does navigator.onLine do?

后端 未结 2 1938
野性不改
野性不改 2021-01-11 13:30

I\'ve seen a thousand posts where someone is asking how to detect internet connectivity in javascript and there is always one person who says to use navigator.onLine and ano

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-11 13:51

    According to MDN, it varies on the browser for implementation.

    https://developer.mozilla.org/en-US/docs/DOM/window.navigator.onLine

    I would assume with WebKit browsers, its not a reliable way to know that a browser has Internet access, just some form of network access.

提交回复
热议问题