asp.net - jQuery Script caching on localhost -


i have asp.net 3.5 web application written in vs 2010. have aspx script reference .js file resides in scripts folder.

<script src="scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script src="scripts/headercontrol.js" type="text/javascript"></script> 

within .js file i'm using jquery various operations, 1 of debugging statement used alert spit out value on page see was.

if ($) {     $(document).ready(function () {         $("input[id='q']").click(function($e) {             alert("clicked");         });     }); } 

this worked great until went remove debug statement (the alert "clicked"). upon removing .js, rebuilt project, hit f5 run on localmachine, clicked upon input tag above the alert still popped , said "clicked". tried 1 thing after trying web app realize .js had been changed, kept displaying alert every time i'd click on input tag. decided rename .js different, @ time web app realized .js had been changed , quit displaying alert when i'd click upon input tag.

so why .js file being cached? it's annoying behavior , i'd love know causing it. appreciated. thanks!

edit: browser ie7. didn't check see if did in mozilla well. regardless, i've done @ least 100 different .js files , i've never noticed behavior before. difference me .js in web app, whereas i'm creating them in asp.net web site projects.

you need shift + refresh, or, clear browser's cache.

this normal behavior:

javascript , css files not check new version (an if-modified-since request) if old version still valid according cache headers in response sent first time.

i believe if put in query string, ?, @ end of url (i.e., scripts/jquery-1.4.1.min.js?) browsers (firefox @ least) change check new version of file every time images. useful during development.

some developers append version file (?123) can cause browser ignore cache when new version of web app released. i'm not sure how effective if have question mark @ end, since looking updated version anyway (again, not sure browsers).


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -