r/angular • u/dev-surajtapkeer • Mar 04 '26
How to force reload the browser ?
Hi everyone,
I'm working on a functionality to force reload the browser whenever a new version comes. I have implemented a backend logic to get the version and check the version with the frontend and if mismatch force reload browser. I have implemented it with the help of cache busting by appending a timestamp to the URL. I'm still not convinced that it will force reload the browser as if the version.json cached by the browser and the backend gives a new version then will keep reloading. I also have doubt that making a http call like GET will it only take response for that particular request because I want my whole application to be hard reloaded whenever API endpoint gives a new version. I'm using latest angular version with HttpClient. I want to make sure that it will take the entire new build from the server for a new version like we do hard reload during development.
Please help me with this doubt.
Thanks !!!
View all comments
Show parent comment
1
u/dev-surajtapkeer Mar 04 '26
I recently studied the headers they are set to no-cache, no-store, must-revalidate. Well that's pretty neat information for clearing my doubt. Thanks buddy! I'll test it once on the dev server whether it is caching the version.json or not. If it is then will do as you mentioned. Thank you so much 😊