-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add a way for users to easily bust browser cache when updating Docsify websites. #2118
Comments
I think the
Then docsify gonna add something like UUID or random version string, timestamp... on the query. About the |
@Koooooo-7 Interesting idea! There is one issue with Ideally want a website's users to fetch new content after we've updated the website. I think the The idea with Maybe a better alternative for This may also relate to |
This code snippet sets the "cache-control" request header to "no-cache". This means that the client (e.g., a web browser) will not use any cached responses when making this request, and instead it will always send a fresh request to the server. In other words, it ensures that the latest version of a resource is fetched from the server each time the request is made, rather than using a possibly outdated copy from the cache. After testing, it was found that this code only takes effect on |
@sogadm's suggest is good for those who with to address cacheing issue via a configuration option. The danger with this method is that site owners may use this option during testing, forget to remove it when done testing, and end up with a live site that disables cacheing for all visitors. Another option is to disable cacheing using your browser's developer tools. This removes the risk of forgetting to remove any kid of test-related cache options. |
For example, add a new
queryForAllRequests
option that is used for all requests. This specifies a query string to use in every request, and when someone updates their site, they can update this string, which will force a browser to treat all requests as new files from network instead of from cache.where any time we update our website, we can change this value, which will force the browser to see all files as new files (uncached). We could then set the cache lifetime to larger number, and use only this approach to bust the browser cache. For example, the browser would request
https://example.com/path/to/file.md?id=123
instead of justhttps://example.com/path/to/file.md
. When we update our site, we can change the option to'id=124'
for example, and then the browser will fetchhttps://example.com/path/to/file.md?id=124
which it will see as a new file and will fetch it from network instead of from local cache.The text was updated successfully, but these errors were encountered: