Base solution for your next web application
Open Closed

Cache Clear for Browsers after new build #6550


User avatar
0
joe704la created

Our app uses the Asp.NET Core & Angular version 6.6.1 .NET Core 2.2 version. I recently made a few small changes to the login screen and then did a production build of the Angular app to deploy the changes. I have received some clients are unable to login now unless they clear their cache in the browser. It seems to be mainly Safari on either iPhones or iPad users more than anything but I am guessing it must be a similar issue on other browsers.

Is there anyway I can combat this issue besides telling clients to clear their cache? I thought "ng build --prod" created unique hashes so it would handle cache busting. But it doesn't seem to be happening.

Any suggestions would be greatly appreciated.


7 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    This seems to be an angular cli problem. https://github.com/angular/angular-cli/issues/10641

  • User Avatar
    0
    joe704la created

    I did see that. But after looking further it does seem ng build --prod is changing some of the files hashes. There are so many files I missed some of the changes and now I can see it did do some changes. Is there any other way that anyone knows of to force a cache clear on the browser?

  • User Avatar
    0
    aaron created
    Support Team

    Try window.location.reload(true).

  • User Avatar
    0
    joe704la created

    Wouldn't that just put me into a reload loop?

  • User Avatar
    0
    aaron created
    Support Team

    When would you force a cache clear on the browser? Not every time you load the page, right?

  • User Avatar
    0
    joe704la created

    I would want to figure out a good way to only do it on the first page load just after a new build only.

  • User Avatar
    0
    maliming created
    Support Team

    @joe704la

    Please follow this issue. https://github.com/angular/angular-cli/issues/10641