Detect WIFI Status of application/page - Salesforce
Hey Guys,
I have come with another interesting scenario which might help people to detect wifi status of your machine. This is a great feature that helps to work applications/pages in offline. mode.
I have come across this situation wherein I wanted my user to stay on a page and give a small online test with clock. Issue was that if wifi goes down for some reason,Clock continued to run as it was made through JavaScript. Clock should also stop in order to avoid wastage of time for user.
I have read many articles and it was written that there is no standard way or function comes in JavaScript that can detect it. A very simple solution could be to hit a public file or url and if response comes ok then that means wifi is working. I have tried to do same thing in Salesforce using Visualforce Remoting that will hit controller's method on server side and checks for connection.
Below is a short video demonstrating it
Full Code:
The code can be seen/directly deployed to any org through this link Detect Wifi Status Code
Happy Coding :)