Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I set the browser to clear the JavaScript file on every visit?

I use Firefox 3.5.7. I am also using the Firebug extension for developing.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I don't think there is a built-in way to stop caching of just javascript within Firefox, but you can stop Firefox from using cached files altogether , which will have the same desired effect for developing. Navigate to about:config in the address bar and filter to network.http.use-cache. Set it to false to stop Firefox from using cached files.

You can do the same with the Web Developer Toolbar:

alt text

share|improve this answer

I don't know your programming skills, and why you want to clear the cache, but if you know how to build a Firefox add-on you can try removing the specified JavaScript file from the cache using the interface nsIDOMOfflineResourceList. You can get information on the MDC specific page.

Or the simple solution could be just to use Ctrl+F5 to reload the page and force the refresh. If it's for websites you develop, you can add a variable at the end of your filename (for example a timestamp or a random number), something like src="../myFile.js?random=1551533331", so the browser will think the file is different and refresh your file everytime (I have never tried it, but it should do the job).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.