Joseph Caruana
Joseph Caruana

Reputation: 2271

IScriptControl - update javascript

In my user controls, I am inheriting from IScriptControl and then referencing a .js file. Currently when I do an update in the .js file, I ask users to clear their browser cache. Is there a way to solve this issue. How can the browser know that a new version has to be downlaoded from the server?

Upvotes: 1

Views: 114

Answers (1)

Eddy Shterenberg
Eddy Shterenberg

Reputation: 199

You should store the JS file inside a DLL as a WebResource and reference to it in ScriptDescriptor. This way ScriptManager generated javascript reference that contains DLL hash in it's URL, thus when you modify your code and recompile - the DLL's hash is changed, forcing the browser to reload JS file (since the framework generates different URL which is based on the DLL's hash).

Upvotes: 2

Related Questions