locked
JavaScript not refreshing in Edge RRS feed

  • Question

  • User438705957 posted

    Our organisation has just upgraded to the latest Edge browser.

    Whenever I migrate a modified JavaScript file to Production, it doesn't always take the latest change immediately.

    I have the following  ?v=1 flag set on the script tag, which is supposed to ignore browser caching, but it doesn't seem to make any difference.

    <script link rel="preload" src="Scripts/TRACS/TRACS_Common.js?v=1"></script>
    

    In order for the change to take effect, I have to delete the cache from Setting--> History

    Further, the problem is intermittent. Sometimes it takes the change immediately, sometimes not.

    Is there a flag I can set in code, in IIS or the browser, to make Edge honour the latest version.

    Thanks

    Tuesday, September 8, 2020 12:09 AM

Answers

  • User409696431 posted

    To clarify: ?v=1 doesn't ignore browser caching.  It caches ?v=1.  What ignores caching is changing that number each time you change the file (v=2, v=3, ...) so that a new version is fetched (and cached).

    Are you changing the number?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 8, 2020 3:35 AM

All replies

  • User-1330468790 posted

    Hi Madog,

     

    Have you changed the value of suffix "v=xxx" when you update the JavaScript file?

    If so, that is really weird since the file is treated as a new resource and the browser should not use cache.

      

    There is another option that you could set the header to force browsers to clear cache.

    Cache-Control: no-cache, no-store, must-revalidate
    Pragma: no-cache
    Expires: 0

    Above headers will be working for all browsers mentioned below:

    Internet Explorer 6+
    Firefox 1.5+
    Safari 3+
    Opera 9+
    Chrome

     More details, you could refer  to below link which provides you with a comprehensive explanation about this issue.

    How do we control web page caching, across all browsers?

     

    Hope this can help you.

    Best regards,

    Sean

    Tuesday, September 8, 2020 2:22 AM
  • User409696431 posted

    To clarify: ?v=1 doesn't ignore browser caching.  It caches ?v=1.  What ignores caching is changing that number each time you change the file (v=2, v=3, ...) so that a new version is fetched (and cached).

    Are you changing the number?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 8, 2020 3:35 AM
  • User438705957 posted

    Ok. Thanks KathyW.

    i had the wrong impression of that. I thought it forced the browser to fetch the latest version.

    Now I understood I have to change the value of that parameter each time, in order to force it to fetch the latest version from the server.

    What I don’t get is why it didn’t happen under IE 11

    Tuesday, September 8, 2020 9:49 AM
  • User-474980206 posted

    IE11 is not as aggressive with caching as chrome or edge.

    Tuesday, September 8, 2020 2:22 PM