caching - Website html doesnt update for users because of cache -


i making website , running issue website cache users. develop website , have set chrome developer tools disable cache website development. issue when release new change prod users don't update because of browser cache. when delete cache website manually on friends computer works cant expect new updates. there anyway me around versioning or something? have looked around cant seem find anything.

edit: know can prevent caching @ don't want prevent caching seems bad design

what resources being cached? suspect js/css files, way handle add query param version path of resources in order force browser load new file if version changed, this:

<script type="text/javascript" src="your/js/path/file.js?v=1"></script> <link href="/css/main.css?v=1" media="screen,print" rel="stylesheet" type="text/css"> 

and when release new update of website, replace version follows:

<script type="text/javascript" src="your/js/path/file.js?v=2"></script> <link href="/css/main.css?v=2" media="screen,print" rel="stylesheet" type="text/css"> 

the browser thing file new file , update cache. hope helps.

in order disable html caching, can add metatag file follows:

<meta http-equiv="cache-control" content="no-cache"> 

but entirely disable caching of html files have metatag, don't think there way handle js/css files, can set metatag refresh html in future date though. here article describing how use metatag if need more info:

http://www.metatags.info/meta_http_equiv_cache_control


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -