How to force IE to reload javascript?

后端 未结 10 1368
清酒与你
清酒与你 2020-12-12 20:41

I\'m using IE 8 on Vista, and everytime I change a javascript file and then start debugging, I have to hit Ctrl+F5 to have it reload my javascript. Is there any way to make

10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-12 21:13

    Paolo's general idea (i.e. effectively changing some part of the request uri) is your best bet. However, I'd suggest using a more static value such as a version number that you update when you have changed your script file so that you can still get the performance gains of caching.

    So either something like this:

    
    

    or maybe

    
    

    I prefer the first option because it means you can maintain the one file instead of having to constantly rename it (which for example maintains consistent version history in your source control). Of course either one (as I've described them) would involve updating your include statements each time, so you may want to come up with a dynamic way of doing it, such as replacing a fixed value with a dynamic one every time you deploy (using Ant or whatever).

提交回复
热议问题