javascript - Chrome keeps caching my old page until I hit the refresh button -
i'm having strange behavior spa
in chrome. i'm running local iis server angularjs
frontend. i'm using gulp
bust-cache javascript , css files. discovered site loading old html files , due angular $templatecache
, used gulp-angular-templatecache
solve new problem appeared.
when turn on pc, start iis server , load application chrome typing localhost
in url bar, chrome loads cache, old js, css , html files (i see chrome loading old index.html
file) if go other route localhost/mainpage
loads new files , works intended. after that, if go localhost
again, old site loaded cache again!!
i'm not expert seems weird behavior. chrome bug? chrome's fault or in angularjs
spa
?
in web.config
have disable caching of index.html
:
<!-- disable index.html cache --> <location path="index.html"> <system.webserver> <staticcontent> <clientcache cachecontrolmode="disablecache" /> </staticcontent> </system.webserver> </location>
and maximize caching time other files:
<system.webserver> <staticcontent> <!-- cache busting 1 year (max recommended value) --> <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="365.00:00:00" /> </staticcontent> </system.webserver>
there's these 2 scenarios:
- when developing, should use
disable cache
option google chrome provides. this, open devtools (chrome menu > more tools.. > devtools), go network tab , check box says disable cache - when releasing production, should use file revisioning tool on minified files. appends hash file's name (like scripts.472bc7.js) avoid cache issues end user's browsers
Comments
Post a Comment