有没有办法提醒用户,以便他们可以在页面上有变化时执行重新加载?
<script type="text/javascript">
var page = 'data/apps/<? echo $_SESSION['name']; ?><? echo $_SESSION['last'];>App.html', lM;
function checkModified() {
$.get(page, function(a, b, x) {
var mod = (x.getResponseHeader('Last-Modified')) ? x.getResponseHeader('Last-Modified') : x.getResponseHeader('Content-Length');
if (lM != mod) {
lM = mod;
console.log('Fetched');
alert
("Changes on "+<? echo $_SESSION['name']; ?><? echo $_SESSION['last']; ?>+"App.html has been made");
}
});
}
setInterval(checkModified, 5000); // every 5 seconds
</script>
这两个页面都位于一个域内。