Skip to content

Instantly share code, notes, and snippets.

@shenmao1989
Created January 16, 2014 12:13
Show Gist options
  • Save shenmao1989/8453965 to your computer and use it in GitHub Desktop.
Save shenmao1989/8453965 to your computer and use it in GitHub Desktop.
服务器时间
var xhr = new XMLHttpRequest();
if( !xhr ){
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
xhr.open("HEAD",location.href,true);
xhr.onreadystatechange=function(){
if( xhr.readyState == 4 && xhr.status == 200 ){
console.log(xhr.getResponseHeader("Date"));
}
}
xhr.send(null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment