asp.net - the browser saved my javascript function name and buged my site -


hello guys today spent half day trying figure out why website went crazy , finnaly managed figure out , wondering can prevent in future. here happened : got simple js file

function standardalert(  )       {       grid1.save()      window.alert( "the information has been saved!" )  } 

now today been doing changes on site , added function different name shows different window.alert

from moment on every time clicked save button had error on error log :

"invalid postback or callback argument. event validation enabled using in configuration or <%@ page enableeventvalidation="true" %> in page...."

i been going crazy.. checking old backups changing , forth changes made today. eventully few minutes ago finnaly found out problem. browser saved old function name , everytime clicked save button had onclientclick event assosiated old function name got error. ofcourse uplodaed different versions of js file didnt matter browser!

so question how can prevent such things in future? p.s had pictures didnt show because browser used old 1 local storage.

forgot mention solved clearing out brows er cache! happen in future when ppl using site , maybe have change js function name again? or maybe picture? dont want have ppl need clear cache solution. sure there missing still new this.

i using ms sql server 2000

when change file on server, need server send new version of file clients (browsers) when request it.

this can achieved in variety of ways - best 1 in cases involves setting server handle changed files (i.e. compare timestamps , decide when it's appropriate send new version of file rather telling client have up-to-date version). depend on server environment (which haven't described in question).

however there way achieve changing stuff on client side only. when requesting file, append unique string it, in way ignored server. way, client cannot possibly think has up-to-date version of file it's requesting. instead of getting, example:

http://example.com/myfile.js

you get

http://example.com/myfile.js?_t=1234567

where number @ end date.now() converted string, example.

however stop caching of myfile.js, , have impact on bandwidth usage. fix on server if possible - how depends on server using though.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -