Search code examples
javascriptexcel-web-addins

I cant save my changes to my code in excel web add in (javascript)


I create an excel web add-in project using Visual studio 2019;
now I make some changes in parser.js a js file in the project,then press F5 to debug,when I step into the code in parser.js,I found it actually run the code in the "parser.js[dynamic]" which is the old version.
I've tried several times,restart,even restart my computer,no use.
What I did wrong???

thanks for JPO's answer,but I got something wrong.

today I changed my code, also my html code, html codes I change are as follows:

<script src="Scripts/Parser.js?version=1.3" type="text/javascript"></script>
<script src="Home.js?version=1.3" type="text/javascript"></script>

yes, the old version is ?version=1.2.
Then press F5 to debug and I get this:
the DOM Explorer Home.html and Home.html

as you can see,the Home.html is changed but the DOM Explorer isn't
it seems like the Home.html has been cached.I wonder if I did something wrong and what should I do?

if you need more information please tell me and I'll post


Solution

  • as mentioned in my comment, this looks like a typical caching problem. Browsers tend to cache resources which aren't supposed to change often. E.g. styles or scripts. Therefore for development, it might be necessary to have tools like "Clear Cache" installed in the browser to clear the caches quickly. Or if it is just one file you are working on, then appending a get parameter e.g. ?version=1 (and increasing the value every time you update code inside the parser.js should be enough. Just don't forget to remove the parameter when you publish your code as the page load times will suffer.

    Welcome to our community!