+ 1
WiFi stuff
Hello, I want to write something that will check if I am connected to the internet, but I donât really know what Iâm doing... I found this method method online somewhere: if(navigator.online == true) { console.log(true)} else {console.log(false);} Iâm not sure if this is working or not(or even working in the way I had intended), but I was curious as to how someone else would do it.
2 Answers
+ 3
Making a xhr request and check its response status.
It's onLine btw.
This is old but there's online and offline event listeners.
window.ononline = function();
0
Awesome thx