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 wont auto clear, the *.md file is still oldest until refresh page by hand #1791

Closed
1 task done
fankes opened this issue Apr 20, 2022 · 2 comments
Closed
1 task done

Comments

@fankes
Copy link

fankes commented Apr 20, 2022

Bug Report

Steps to reproduce

Whether debugging locally or publishing to a github page *.md documents automatically generated md files are always cached and need to be manually refreshed on each page to get the latest *.md documents.

I tried the following method but it still doesn't work

 window.$docsify = {
        requestHeaders: {
            'Cache': 'no-cache',
            'Cache-Control': 'no-cache, must-revalidate',
            'Pragma': 'no-cache',
            'Expires': '0',
            'If-Modified-Since': 'Thu, 01 Jun 1970 00:00:00 GMT'
        }
}

Two issues with the same problem: #1119 #937

↑ Tried the solution but still doesn't work.

What is current behaviour

The document does not automatically refresh when the page is closed and reopened, requiring the user to manually refresh (this will cause confusion for users reading the document with old versions)

What is the expected behaviour

Get the latest version of *.md files in real time

Other relevant information

  • Bug does still occur when all/other plugins are disabled?

  • Your OS: MacOS 12.3.1

  • Node.js version: 12.16.2

  • npm/yarn version: 6.14.4

  • Browser version: Chrome

  • Docsify version: 4.12.2

  • Docsify plugins: I think there is no plugins called this bug

Please create a reproducible sandbox

sandbox can't reproduce this problem, only in browser.

Mention the docsify version in which this bug was not present (if any)

Not found yet.

@trusktr
Copy link
Member

trusktr commented Jul 4, 2023

The issue described here seems to be not Docsify's problem, but how browsers cache files, and whether or not static servers obey request headers. A static server should tell the browser not to cache anything (if desired) or to set a certain cache duration.

On the other hand, if you've cleared the applications local storage (f.e. in the Chrome devtools Application tab) and even disabled the browser cache (f.e. in the Chrome devtools Network tab), but you are still seeing old content upon a force refresh (f.e. cmd-shift-r in macOS, otherwise ctrl-shift-r), then that is another issue.

@fankes You mentioned that if you force refresh, you do see the content. In that case, the issue isn't with Docsify, but regarding how your server of choice is serving files, and whether it obeys the request headers, and whether it sends the appropriate headers in the response.


We should consider adding a simple cache-busting option to Docsify, f.e. something like described in #2118. Closing this one in favor of that one.

@trusktr trusktr closed this as completed Jul 4, 2023
@fankes
Copy link
Author

fankes commented Jul 4, 2023

This issue is a long time ago, and it's really a browser problem.
Now I am using vuepress instead it, when I published on github.io (static compiled website) it has the same cache problem, but vue using random file extension to fix this problem, it work well in some time, but some time not caused by github.io cdn cache (I think), so it still a server or browser's problem.
But thank you for your job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants