javascript - Detect application version change on a single page application -


today question raised here , don't have evident answer.

assume concatenate , minify resource files (css , javascript) , declare them in "master-page".

on multi-page app, if css file changes recharged on next full page load.

on single-page app, user can keep working days , never recharge main page css files declared. user never see changes until ctrl-f5 issued.

i'm sure thought of , have experience share :)

for me, using websockets not option. first because it's overkill , second because not clients support technology. same reason applies websockets fallbacks... won't keep hitting servers because of this.

so, ideas anyone? :)

btw, we're using angularjs if can specific solution.

thanks!

i've getting through same problem. solution opiniated , may not respond criterias :

when package front-app , server-app, share configuration file containing current version of front-app.

front side : 75% of routes change implicitely call webservice (route change resolve). each time call server include custom http header (or get/post param) containing client version of front-app.

server side : compare front-app version (the 1 in browser of user, loaded last time user refreshed/loaded spa) front-app version of shared configuration file :

  • if version matches : nothing.
  • if version don't match send custom http status error code (418 example)

then front side: added response interceptor intercepts 418 error code , force-refresh of whole app

that's it. event "check" if front-app version latest route change (that calls ws via ajax). add infinite $timeout callind dedicated ws each 5 minutes or so... can add code if needed.

hope helps ;)


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -