Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8738211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:41:24+00:00 2026-06-13T10:41:24+00:00

Github pages sets very aggressive cache headers ( Cache-Control: max-age=86400 1 day, Expires 1

  • 0

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:

  1. determine you are running on github pages: easy, parse window.location for github.com/
  2. 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?
  3. 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?
  4. 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:41:25+00:00Added an answer on June 13, 2026 at 10:41 am

    To have a better control of the caching of your website you can use the HTML5 cache manifest. See:

    • A Beginner’s Guide to Using the Application Cache on HTML5 Rocks
    • Using the application cache on Mozilla Developer Network
    • Cache manifest in HTML5 on Wikipedia
    • Offline Web Applications W3C Working Group Note
    • Offline Web applications at WHATWG

    You can use the window.applicationCache.swapCache() to update the cached version of your website without the need for manually reloading the page.

    This is a code example from HTML5 Rocks explaining how to update users to the newest version of your site:

    // Check if a new cache is available on page load.
    window.addEventListener('load', function(e) {
    
      window.applicationCache.addEventListener('updateready', function(e) {
        if (window.applicationCache.status == window.applicationCache.UPDATEREADY) {
          // Browser downloaded a new app cache.
          // Swap it in and reload the page to get the new hotness.
          window.applicationCache.swapCache();
          if (confirm('A new version of this site is available. Load it?')) {
            window.location.reload();
          }
        } else {
          // Manifest didn't changed. Nothing new to server.
        }
      }, false);
    
    }, false);
    

    To avoid some confusion I’ll add that GitHub sets the correct HTTP headers for cache.manifest files:

    Content-Type: text/cache-manifest
    Cache-Control: max-age=0
    Expires: [CURRENT TIME]
    

    so your browser knows that it’s a cache manifest and that it should always be checked for new versions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm hosting few static web pages on GitHub (gh-pages). If the user tries to
I have org files in a github repository and using project pages future. Exporting
I have a git repository (at github.com) with two branches: master and gh-pages. I
I created a gh-pages branch of my repo, looking to create a github page
Github recently released a new Windows application , with some very interesting UI ideas.
I'm serving my JSONP JavaScript file on a static file server - GitHub Pages.
My blog was successfully transferred to octopress and github-pages. My problem though is that
I had two branches ( master and gh-pages ) in github git repo https://github.com/larrycai/LASO
On GitHub's Twitter bootstrap pages the Base CSS page's section on icons says this:
I was following the instructions on making github pages , and forgot to move

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.