수제녹차 2021. 11. 22. 11:46
728x90
반응형

* navigator.onLine

return true or false (boolean)
온라인 상태인지, 오프라인상태인지 확인할 수 있다

 

* Returns the online status of the browser. The property returns a boolean value, with true meaning online and false meaning offline. The property sends updates whenever the browser's ability to connect to the network changes. The update occurs when the user follows links or when a script requests a remote page. For example, the property should return false when users click links soon after they lose internet connection.

source: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine

반응형