angularjs code changes do not show up after browser refresh

后端 未结 17 1677
北海茫月
北海茫月 2020-12-13 09:35

Any time, I make code changes in .hmtl file or the .js file, the browser still renders the old code and my new code changes don\'t show up in the browser result.

Fo

17条回答
  •  感情败类
    2020-12-13 10:06

    Problem

    • Client-side (Browser) caching of static files in dev enviornment
    • Server-side (IIS Express) caching of static files in dev enviornment

    Solutions

    For Client-side (Browser) caching of static files in dev enviornment

    • Web.Config/ApplicationHost.config Approch: Web.config Approach suggested by @NateBarbettini above. Please note that this approach is also can be applied to 'Applicationhost.config' instead of web.config file.
    • "Always Refresh From Server" in IE as suggested above by @Phil Degenhardt. Please find screenshot below.
    • Navigate to source file location in browser address bar: Try to navigate to the JavaScript file in question by typing the address. It will show you JavaScript file contents. Once you do this, file gets updated.So you can again go back and try to navigate to proper landing page of your application. This time, you will see you get latest JavaScript code getting executed. e.g. If you have problem with not updating 'app/home/home-account.js'. Then in browser navigate to 'http://[your-host/localhost]:[specified port of your application]/app/home/home-account.js. This will show you the contents. Then again navigate to your application's home page i.e. in this case 'http://[your-host/localhost]:[specified port of your application]/'

    For Server-side (IIS-Express) caching of static files in dev enviornment

    • visit IIS Express appcmd commandline utility. In my case, appcmd is located in "C:\Program Files(x86)\IIS Express\appcmd.exe" this path. Then use SITE list and SITE delete command to remove temporary files cached in iisexpress.

    • There is also one solution which is specific to IE mentioned here: Visual Studio 2013 caching older version of .js file

提交回复
热议问题