Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser Caching Prevents Client-Side Website Updates #77

Closed
bcbielecki opened this issue Nov 6, 2023 · 3 comments · Fixed by #83
Closed

Browser Caching Prevents Client-Side Website Updates #77

bcbielecki opened this issue Nov 6, 2023 · 3 comments · Fixed by #83
Assignees
Labels
bug Something isn't working

Comments

@bcbielecki
Copy link
Member

As shown below, certain browsers like Chrome cache css and js files instead of GETing the most recent files from the server.
This poses a major issue as we put up weekly updates to the site that students need to see immediately on their end.

image

An inelegant solution we have is to use a special meta tag on all projects pages OR a query param on the js scripts for the pages with js-based footers and headers. This would force the browser to fetch the newest files, but I think it will require a lot of upkeep for us to maintain long-term as we add more files. It's better than nothing though.

https://stackoverflow.com/questions/30764510/website-html-doesnt-update-for-users-because-of-cache

@bcbielecki bcbielecki added the bug Something isn't working label Nov 6, 2023
@dylanvu
Copy link
Collaborator

dylanvu commented Nov 10, 2023

I am doing some investigation on industry standards here, and this is what someone mentioned: hashing our js files

mkdocs/mkdocs#1979 (comment)

I'm looking to see if we can automate hashing of our js files through our github workflows maybe

@dylanvu
Copy link
Collaborator

dylanvu commented Nov 10, 2023

I think that I will implement some sort of hashing and attach it to our current workflow:
https://javascript.plainenglish.io/what-is-cache-busting-55366b3ac022
https://www.keycdn.com/support/what-is-cache-busting#2-file-path-versioning

@dylanvu
Copy link
Collaborator

dylanvu commented Nov 10, 2023

image
hashing script seems to have worked

@dylanvu dylanvu linked a pull request Nov 10, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants