1

We have an angular 5 app that is used on mobile in google chrome browser. The users are always in the app, so they are not closing browser or calling the app new. if we update now the dist because we build a new version, how can we be sure that the users are getting the new build? our workaround was an window.location.reload(); but its not really smooth.

is there a other solution?

6
  • Well we have focused the same problem and solved it by listen to a SignalR Service. Could also be a socket.io Server/Client implementation. Then if we release a new version we can send a refreshEvent with or without force option. That triggeres in the end the window.location.reload(boolean). Commented Oct 5, 2018 at 8:45
  • Service worker already does everything you want. Just use it Commented Oct 5, 2018 at 9:17
  • @smnbbrv can you explain it to me? because we are already using service worker (PWA) Commented Oct 6, 2018 at 7:10
  • 1
    angular.io/guide/service-worker-communications - you get an update and refresh the page. There is no other way you can do the update other than refresh, currently. If you want to make it that smooth that nobody even understands that will consume lots of your time and in the end will never be stable. Browser refresh is the best here Commented Oct 6, 2018 at 8:04
  • @smnbbrv thanks i got it running local and its working like a charm - but on our server (https) its not working (not getting update) - do you have any idea? Commented Oct 6, 2018 at 9:37

1 Answer 1

1

I faced same issue today. For angular easy solution is to use

ng build --output-hashing all

The command will hash all your files and add hash to their names. If file is modified, hash is changed and so is file name, forcing the browser to download the new version of that file.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.