Question:
Is it possible to cache a JavaScript or remote .JS file on a client? It seems that while you can cache images, HTML, objects, and so on, caching .JS scripts is not straightforward.
Answer:
Actually, one of the main benefits for putting your code into a separate .JS file as opposed to including directly within your page is that it improves performance. Both Netscape and Internet Explorer will cache your JavaScript code automatically?you don’t need to do anything at all to make this happen. In addition, your HTML pages will also become smaller because instead of including all of your JavaScript on every page you can centralize code to one or more .JS files. Finally, this should also make maintaining your code easier since it will all be in .JS files instead of being spread out across all of the pages on your site.