Trace Trace - 4 months ago 10
Javascript Question

Is there a way to do a http head request and get the time without a server side langauge

Ok so I am trying to do a http head request from the Javascript code to get the server time ...Can i do this from javascript or do i need a server side language to achieve this

Answer

Assuming your server sends the Date header (which the RFC says it MUST), sure:

$.ajax('/', {
    type: 'HEAD',
    success: function(r,status,xhr) {
        alert(xhr.getResponseHeader('Date'));
    }
});