V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
zxCoder
V2EX  ›  问与答

网站前端更新了,怎么提示让用户 ctlr+F5 刷新一下呢,不然总是执行了缓存的老代码

  •  
  •   zxCoder · Aug 20, 2021 · 1445 views
    This topic created in 1715 days ago, the information mentioned may be changed or developed.
    happyeveryday
        1
    happyeveryday  
       Aug 20, 2021
    一般资源通过打 hash 能避免缓存,不过遇到过 index.html 被缓存了就比较麻烦
    eason1874
        2
    eason1874  
       Aug 20, 2021
    网页禁止缓存,静态文件资源路径加上版本号或者 hash,就 OK 了
    lynan
        3
    lynan  
       Aug 20, 2021
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    shakaraka
        4
    shakaraka  
    PRO
       Aug 20, 2021   ❤️ 1
    一般不缓存 index.html,依赖 css 、js 加 hash
    NewYear
        5
    NewYear  
       Aug 20, 2021
    我们内部系统,魔改了 JS 文件,结果看到很多同事的界面,接近半年了还是用的缓存 JS 文件,吐血。
    circleee
        6
    circleee  
       Aug 20, 2021
    @NewYear 这。。。
    jarl
        7
    jarl  
       Aug 20, 2021
    js?version=时间戳
    css?version=时间戳
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2123 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 00:34 · PVG 08:34 · LAX 17:34 · JFK 20:34
    ♥ Do have faith in what you're doing.