After the Tomcat service is started, js and css cannot be refreshed in real time due to browser cache. Is there any way to clear the browser cache when the customer logs in to send a request?
ringa_lee2017-05-17 10:09:22
If we just talk about browser cache, I suggest you use the incognito mode of Google Chrome. There will be no cache or cookies in incognito mode. The shortcut key to open it is
. On Mac, replace ctrl with commd. ctrl +shift+n
PHP中文网2017-05-17 10:09:22
If you don’t want to clear the cache, add a timestamp after the request.
高洛峰2017-05-17 10:09:22
This is what it looked like before upgrading:.../.../foo.js?v=1
,升级之后这样:.../.../foo.js?v=2
大家讲道理2017-05-17 10:09:22
The browser cache has nothing to do with restarting Tomcat. Every browser has it. There are three ways to clear the cache. As follows:
Clear all browser caches, take chrome under mac as an example, chrome preferences-advanced settings-privacy settings-clear browsing data
Open the console and check ☑️ Disable cache
Ctrl+Shift+N or Command+Shift+N to open the privacy window
仅有的幸福2017-05-17 10:09:22
1. Go to /work/Catalina/localhost corresponding to tomcat and find the corresponding project folder. Delete it, or delete the /localhost folder directly. This step is just to clear the jsp cache.
2. Static files such as js/css files Add the version number at the end, such as /common.js?v=1.0
3. You can add no-cache restriction in the head to cancel the page cache
習慣沉默2017-05-17 10:09:22
This needs to be cleaned by the user themselves! Unless you dynamically obtain static resources