I ran into this problem. My solution is very simple and is not really trying to avoid errors for the user. This is similar to your decision a .
I save the version number, for example, a fingerprint (all files also have fingerprints, CSS / JS). The deployment process automatically increments the version number. Even if I just changed one line of CSS, the version number is incremented. I do not distinguish between major or minor changes in the version, this is only semantics.
The application checks the server so often to check the version. If the version changes, βplease reload the pageβ appears, a pop-up window appears. (A non-intrusive little thing at the top of the page, which is very noticeable and obvious and needs to be pressed). If the user does not restart, you may encounter errors, so I will also turn off the error report if the version does not match.
This solution ensures that eventually people will switch to the new version and you wonβt get any errors during the user switch. It does nothing to transfer old sessions or prevent errors for the user.
I would not do window.confirm . Unexpected modal dialogs are very annoying. If you type something and press [space-bar] or [enter] , the dialog disappears and you skipped it.
Solution b may seem nice, but there is a flip side. You may be able to detect version mismatch earlier, but it may also mean that your users see more errors. Update, if only a small part of the website affected the update, any XHR request will fail, even if it did not need to fail. This is what you need to consider.
Solution c is very pleasant for the user, but can improve hell. What if your database model changes? The old server will not be able to manipulate the data correctly, requests will fail, etc.
I like solution a because it is very simple, and if you update a lot of small changes frequently, the impact of each update is very small.