Github pages sets very aggressive cache headers (Cache-Control: max-age=86400
1 day, Expires
1 month ahead) on all served content.
If you update your pages and push to github, people revisiting the pages who have already got cached copies will not get the new pages without actually cleaning their browser cache.
How can a script running in a page determine that it is stale and force an update?
The steps might be:
- determine you are running on github pages: easy, parse
window.location
forgithub.com/
- determine current version of page: hard, git doesn't let you embed the sha1 in a commited page; no RCS
$id$
. So how do you know what version you are? - get the current version in github; hard, github got rid of non-authenticated v2 API. And there's a time disconnect between pushing to github and github getting around to publishing too. So how do you know what version you could get?
- having determined you're stale, how do invalidate a page and force reload? hard,
window.location.reload(true)
doesn't work in Safari/Chrome, for example...
So its solve-these-steps; of course there may be another way?