3

I am developing a large angular.js / mvc webapi SPA that resides on private networks. When I deploy a new version of the app to the customer's site via an installer, the client's browser software just keeps running the old module, even across login / logout. The browser just uses the cached version of the application's main module.

In the past, on other platforms, like ASP.NET, I have used a web service that publishes a version, and added ?version=123 to every javascript resource request in order to force the client version to stay up to date, regardless of how aggressively the client browser caches javascript files.

What is the best strategy to solve this in a single page application that stays in memory. If I hit a webservice in angular, how can I go around the route provider and just force it to re-load the actual javascript file that hosts the main application module?

What strategy do installed web-app developers in the angular space use to solve this?

1 Answer 1

1

I don't have 50 reputation points yet, so I can't comment and I leave it as an answer.

In our project we using TeamCity to deploy web applications and we are using console application that runs on deployment stage. Console application uses T4 template for index.html transformations on every deploy. That how we are adding version parameter to the script url. T4 templates can be replaced by razor engine or any other technology.

Another approach is to use ASP.NET only for getting main view, but I preffer don't include ASP.NET to a web application only for one simple task.

Still I think our solution looks too heavy and it's interesting is there any more simple solution.

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

2 Comments

We ended up having a version http API that gets checked by the UI periodically. If the server version changes from what's in scope, we force a reload via javascript.
And now we have a SignalR webapi hub that pushes this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.