views:

12473

answers:

9

During development I have to "clear cache" in Firefox all the time in order to make it use the latest version of JavaScript files.

Is there some kind of setting (about:config) to turn off caching completely for JavaScript files? Or, if not, for all files?

+4  A: 

Have you tried to use CTRL-F5 to update the page?

some
I really have doubts that this works reliably, at least in the presence of iframes and framesets.
Thilo
correct, it won't always reload the JS/CSS in an iframe, but in Firefox you can at least pop that frame out into a new tab, and reload there.
scunliffe
+12  A: 

In about:config set:

network.http.use-cache = false
tst
+1  A: 

You can use Ctrl-f5 to reload bypassing the cache.

You can set the preferences in firefox not to use the cache

network.http.use-cache = false

You can setup you web server to send a no-cache/Expires/Cache-Control headers for the js files.

Here is an example for apache web server.

Pat
is that shift-f5 or ctrl-f5 ?
Thilo
+2  A: 

Best strategy is to design your site to build a unique URL to your JS files, that gets reset every time there is a change. That way it caches when there has been no change, but imediately reloads when any change occurs.

You'd need to adjust for your specific environment tools, but if you are using PHP/Apache, here's a great solution for both you, and the end-users.

http://verens.com/archives/2008/04/09/javascript-cache-problem-solved/

scunliffe
+2  A: 

If you're working with server side code you could generate a random number and append it to the end of the src in the following manner....

src="yourJavascriptFile.js?randomNumber=434534"

with the randomNumber being randomly generated each time.

+17  A: 

The Web Developer Toolbar has an option to disable caching which makes it very easy to turn it on and off when you need it.

Phil
CTRL-F5 or holding down the shift key while clicking the Reload button is what I have done in the past, but the Web Developer Toolbar's "Disable Cache" feature is a great way to do that. You don't have to entirely disable firefox's cache that way.
Jon
A: 

I use CTRL-SHIFT-DELETE which activates the privacy feature, allowing you to clear your cache, reset cookies, etc, all at once. You can even configure it so that it just DOES it, instead of popping up a dialog box asking you to confirm.

Mr. Shiny and New
A: 

thx for info

A: 

Excellent, I really thank full for many advice,

Luckman Raharja From Indonesia............

That was great, I have a real pain fromthis, and I started to complain my web provider that they are not refreshed even if my js ajax uploaded.

Thank you, for this resource, everyone is trying the best.

But in FireFox is it not Shift+F5 rather than Ctrl+F5. Many Thanks

my email: [email protected]