search

Home  >  Q&A  >  body text

javascript - How to clear the browser cache after the tomcat service is started?

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?

怪我咯怪我咯2865 days ago852

reply all(7)I'll reply

  • ringa_lee

    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

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-17 10:09:22

    1.ctrl+F5 refresh all resources.

    2.js/css added version control

    reply
    0
  • PHP中文网

    PHP中文网2017-05-17 10:09:22

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

    reply
    0
  • 高洛峰

    高洛峰2017-05-17 10:09:22

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

    reply
    0
  • 大家讲道理

    大家讲道理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

    reply
    0
  • 仅有的幸福

    仅有的幸福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

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-17 10:09:22

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

    reply
    0
  • Cancelreply