虚拟主机域名注册-常见问题 → 网络编程问题 → JS | |||||||
js 网页最后更新时间超过多少秒后重新生成
//获取当前时间戳(以s为单位) var timestamp = Date.parse(new Date()); timestamp = timestamp / 1000; //获取网页最后更新时间 var stringTime = document.lastModified; var timestamp2 = Date.parse(new Date(stringTime)); timestamp2 = timestamp2 / 1000; console.log(stringTime + "的时间戳为:" + timestamp2); if(timestamp-timestamp2>100){ //重新生成网页的执行语句 }
|
|||||||
>> 相关文章 | |||||||
发表评论 | |||||||