我使用jQuery插件倒计时(http://keith-wood.name/countdownRef.html),并使用serverTime功能:jQuery的倒计时IE刷新问题
function serverTime() {
var time = null;
$.ajax({url: 'cgi/server-time.php',
async: false, dataType: 'text',
success: function(text) {
time = new Date(text);
}, error: function(http, message, exc) {
time = new Date();
}});
return time;
}
现在,当我点击刷新,火狐是正确的,但IE浏览器将时钟重置为完全不正确的设置时间,即Firefox说44分钟剩余时间,IE说1小时36分钟。
如果我将async设置为true,那么它使用的本地机器时间也可能不正确。
服务器time.php
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Fri, 1 Jan 2010 00:00:00 GMT"); // Date in the past
$now = new DateTime();
echo $now->format("M j, Y H:i:s O")."\n";