javascript - How to clear the browser cache after the tomcat service is started?
怪我咯
怪我咯 2017-05-17 10:07:22
0
7
731

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?

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(7)
左手右手慢动作

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

给我你的怀抱

1.ctrl+F5 refresh all resources.

2.js/css added version control

Ty80

If you don’t want to clear the cache, add a timestamp after the request.

小葫芦

This is what it looked like before upgrading:.../.../foo.js?v=1,升级之后这样:.../.../foo.js?v=2

大家讲道理

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

仅有的幸福

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

習慣沉默

This needs to be cleaned by the user themselves! Unless you dynamically obtain static resources

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template