
I'd also like to highly recommend this JavaScript book by Douglas Crockford - it will definitely improve the quality of your JavaScript development experience!
Surely everyone that does their own clientside Javascripting of the MS-CRM interface is already using the technique described by the almighty Ronald Lemmen to link to .js files to speed up the development process, since it removes the need to republish your entity forms over and over after each scripting change. Although unsuited for use in a production environment (for various reasons), this method has undoubtedly saved me hours in development time.
What I couldn’t understand though was why my updates often didn’t take effect, despite updating and saving my script files and even closing my browser. I even looked around for some evidence that I wasn’t the only one on the planet with this problem. Google suggested I was, so I had to find my own solution.
The problem appeared to be that the .js file was being helpfully cached in IE. By clearing my cache and fully reloading the page, I could solve the problem. Still, it was annoying. My preferred solution is a bit ugly but works a treat – when calling the JavaScript file, ensure that the script source is located at a unique URL each time the page loads. I use the getTime() method of the Date object to give a totally unique URL for that moment in time. The harness to load all my JavaScript files now looks like this:
var dt = new Date();
rndURL = "<script src='full_path_to_source_file.js?random='" + dt.getTime() + "' language='JavaScript'>";
st = document.createElement(rndURL);
h = document.getElementsByTagName('head');
h[0].insertAdjacentElement('beforeEnd',st);
Obviously this script is entirely unsupported by Microsoft, but if you happen to become the second person on the planet to experience the same caching issue I did, this just might save you some time.
Don’t forget that the first time you paste this code into your form onLoad event, you’ll need to republish your form, flush the browser cache, restart IIS, turn around three times then hit F5 in IE before the randomising magic works for you.




A perfect solution to a problem I’ve been having, works perfectly, thanks!