서버시간 알아내기 정보
JavaScript 서버시간 알아내기본문
var xmlHttp;
function srvTime(){
if (window.XMLHttpRequest) {//분기하지 않으면 IE에서만 작동된다.
xmlHttp = new XMLHttpRequest(); // IE 7.0 이상, 크롬, 파이어폭스 등
xmlHttp.open('HEAD',window.location.href.toString(),false);
xmlHttp.setRequestHeader("Content-Type", "text/html");
xmlHttp.send('');
return xmlHttp.getResponseHeader("Date");
}else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
xmlHttp.open('HEAD',window.location.href.toString(),false);
xmlHttp.setRequestHeader("Content-Type", "text/html");
xmlHttp.send('');
return xmlHttp.getResponseHeader("Date");
}
}
var st = srvTime();
var today = new Date(st);
추천
0
0
댓글 0개