QUOTE(s3s3 @ Mar 17 2012, 01:04 PM)
Unintelligent way seems ok since if the web server on the board is down it doesnt matter if te board is still connected or not, what would I have to use in order to accomplish this "unintelligent" way? give me a starting point
You could try XMLHttpRequest, but most modern browsers will block access to the local network.
CODE
var request = new XMLHttpRequest();
request.open("GET", "http://127.0.0.1/", false);
request.send(null);
console.log("Request status: " + request.status);
if (request.status === 200)
{
console.log("The web server responded.");
}
You could also try to find an image hosted on the web server.
CODE
var image = new Image();
image.src = "http://127.0.0.1/image.png";
image.onload = function onload()
{
console.log("The web server responded.");
};
QUOTE(s3s3 @ Mar 17 2012, 01:04 PM)
And since u mentioned the unintelligent way, What would be the inteligent way to do it then?(just for the sake of curiosity)
An intelligent method would not rely on a web server to check network connectivity because an offline web server does not mean that the client is disconnected from the network. A smarter program would try pinging and would probably monitor the local network for client activity as a fallback.