Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Dealing with browser caching and updated script files

Dealing with browser caching and updated script files

Scheduled Pinned Locked Moved JavaScript
asp-nethelpcsharpjavascripthtml
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Matt U
    wrote on last edited by
    #1

    I encounter this issue fairly regularly at work, and I'm interested in learning about how others handle it. Basically, when you have a Web app and you make some changes to a JavaScript file, how do you ensure that the correct script is loaded when users navigate to the updated Web app? We're using ASP.NET MVC, IIS 7. I've done some digging online and a common solution seems to be appending some sort of identifier to script files in the markup, like this:

    Where 'v' is maybe a version number or something along those lines, updated with each deployment. I came across a StackOverflow post in which someone provided a custom HtmlHelper method to append the file's 'LastWriteTime'. But I was wondering how you all handle this. Thanks in advance!

    djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

    L 1 Reply Last reply
    0
    • M Matt U

      I encounter this issue fairly regularly at work, and I'm interested in learning about how others handle it. Basically, when you have a Web app and you make some changes to a JavaScript file, how do you ensure that the correct script is loaded when users navigate to the updated Web app? We're using ASP.NET MVC, IIS 7. I've done some digging online and a common solution seems to be appending some sort of identifier to script files in the markup, like this:

      Where 'v' is maybe a version number or something along those lines, updated with each deployment. I came across a StackOverflow post in which someone provided a custom HtmlHelper method to append the file's 'LastWriteTime'. But I was wondering how you all handle this. Thanks in advance!

      djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      For example, read this Strategies for Cache-Busting CSS | CSS-Tricks[^] also see ASP.NET Performance | Cache busting using assembly version for RequireJS / ASP.NET MVC projects[^] and What is cache busting? - Curtis Timson[^] Hope they help.

      M 1 Reply Last reply
      0
      • L Lost User

        For example, read this Strategies for Cache-Busting CSS | CSS-Tricks[^] also see ASP.NET Performance | Cache busting using assembly version for RequireJS / ASP.NET MVC projects[^] and What is cache busting? - Curtis Timson[^] Hope they help.

        M Offline
        M Offline
        Matt U
        wrote on last edited by
        #3

        Ah, wonderful! Thanks! I'll read over them today or tomorrow.

        djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups