Reputation: 89
We have a static HTML file that is updated in every 10-30 minutes (random time between the two timeframe).
We are using:
<META HTTP-EQUIV=refresh CONTENT=600>
Q: But we need to only refresh the page on client side if the HTML file is really updated. How can we do this? Can JavaScript check if the static HTML page was re-created?
UPDATE: could it help that I can create another HTML file ex.: foo.com/status.html with the following: - normally the content of it would be "0" - but if the html get's updated, for 10 seconds, the status.html file would be "1"
UPDATE#2: there is no jQuery (yet?) in the html file. Using apache2. (exactly what configs needed? )
Upvotes: 2
Views: 109
Reputation: 40527
Well you cannot really check if HTML file is recreated without hitting server. Only thing you can do is make an AJAX call and get last modified time of file. Compare it with some stored modification date-time value and issue refresh command if it is modified after stored value.
Don't know what you are using on server side. Also if you are using jQuery it is really easy to make AJAX call with $.ajax
.
Well on other hand if it is not modified shouldn't it be cached? On your server or somewhere in-between?
PS:- If you can post server side setup details we can help you better.
Upvotes: 6