/* Ajax with Un Cached output in MSCRM 4 */
function _LoadIsvScript(execute) {
var JsScriptUrl = "/ISV/customscript.js";
var strServerURL = SERVER_URL.split(ORG_UNIQUE_NAME);
var script_uri = strServerURL[0] + JsScriptUrl;
var ajax = new ActiveXObject("Msxml2.XMLHTTP");
ajax.open('GET', script_uri, false);
//GetUnCachedVersion
ajax.setRequestHeader("If-Modified-Since", "Sat, 01 Jan 2000 00:00:00 GMT");
ajax.setRequestHeader('Cache-Control', 'no-cache');
ajax.send('');
return ajax.responseText;
}
Get UnCached version form Ajax file request
While loading external javascript there is problem of caching the general solutionfor this is appending a url parameter like "?rnd=Date.Now()" at the end of the url, so that the url is always unique while making the call. The other way around is to set the IIS ouput caching with FIle change notifications. But the same could be achieve without much effort by setting the response header. We can set the response header to get the modified version from the server instead of the cached one using the following script:
Subscribe to:
Posts (Atom)