How can I check for a javascript file in user\'s cache. If he refreshed the page or visits the site after sometime. I need not download that js file again. Does the js file
The browser will automatically look after what it has in it's own cache. There are various mechanisms you can use for controlling it however.
Look into the various HTTP caching headers, such as:
The Expires header is the most critical of these when it comes to client-side caching. If you set a far future Expires header (eg, 10 years) the browser will not (in theory) not look to the server again for that file. Of course then you need a method of changing the file name when the contents of the the file change. Most people manage this by adding a build number to the file path.