You can call window.location.reload(true) to reload the current page.(您可以调用window.location.reload(true)重新加载当前页面。)
It will ignore any cached items and retrieve new copies of the page, css, images, JavaScript, etc from the server.(它将忽略所有缓存的项目,并从服务器检索页面,css,图像,JavaScript等的新副本。) This doesn't clear the whole cache, but has the effect of clearing the cache for the page you are on.(这不会清除整个缓存,但是会清除您所在页面的缓存。)
However, your best strategy is to version the path or filename as mentioned in various other answers.(但是,最好的策略是按照其他答案中所述的方式对路径或文件名进行版本控制。) In addition, see Revving Filenames: don't use querystring for reasons not to use ?v=n
as your versioning scheme.(另外,请参阅修订文件名:由于不使用?v=n
作为版本控制方案,因此请勿使用querystring 。) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…