The way I do it with javascript on the client side is the following
function srvTime(){
try {
xmlHttp = new XMLHttpRequest();
}
catch (err1) {
//IE
try {
xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
}
catch (err2) {
try {
xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
}
catch (eerr3) {
alert("AJAX not supported");
}
}
}
xmlHttp.open('HEAD',window.location.href.toString(),false);
xmlHttp.setRequestHeader("Content-Type", "text/html");
xmlHttp.send('');
return xmlHttp.getResponseHeader("Date");
}
However with node.js I can not since the XMLHttpRequest library does not detect me and marks window as undefined.
How could I do it with node
Note: I need the server I'm connected to, not the one on the device.