Jump to content

Firefox cache


crmamx

Recommended Posts

I am having a heck of a time with testing my site. I make a change, upload it, test it and it doesn't work. Then I fool around with the code for who knows how long and it still doesn't work. Finally I will clear the cache and many, many times that is the problem.

 

How can I fix this? My cache is set at 50 mb.

 

Also, when I clear it, it clears my search history too and I don't want to do that.

Link to comment
Share on other sites

You should only put your code onto a live server once it is completely tested. You will waste a huge amount of your time, constantly uploading code just to see the result of each change.

 

Dynamically produced pages, where each request for the same URL can contain different content, should output headers that prevent caching. There are many ways of accomplishing this, but it should be done globally in a .htaccess file or similar so that you don't need to do it in your code.

Link to comment
Share on other sites

You should only put your code onto a live server once it is completely tested. You will waste a huge amount of your time, constantly uploading code just to see the result of each change.

 

Well that's not really the root of the problem.  Even if he was saving it on his own computer he would still be testing it through his browser, which would cache the content all the same.

Link to comment
Share on other sites

What in particular is not refreshing? Is it php, javascript or css thats causing the issue?

 

Usually it is my css file.

 

I suggest a few add-ons that will really help with development:

 

I have Firebug. The other one are you referring to adding is it: Web Developer 1.1.9?

 

You should only put your code onto a live server once it is completely tested. You will waste a huge amount of your time, constantly uploading code just to see the result of each change.

 

You are right, I spend a lot of time changing, uploading and viewing the changes. But I don't have any other way to do it. I just don't want to install a server and the stuff I need to do it on my computer. This is my only site. If I was a developer, no question I would do it.

 

There are many ways of accomplishing this, but it should be done globally in a .htaccess file or similar so that you don't need to do it in your code.

 

Have no idea even what you are talking about. I will Goggle .htaccess and see what I come up with.

Link to comment
Share on other sites

If its your css that is causing you a problem then you might want to append a random number to the end of the tag. This will force the users browser the refresh to the new script.

<link ... href="path/to/my.css?version=1234523123">

if you are using php in the page then you could just try appending the current time to it using the time function

<link ... href="path/to/my.css?version=<?php echo time(); ?>">

 

this will ensure every upload is unique

Link to comment
Share on other sites

.htaccess example (modify the list of file extensions to suite your needs) -

<IfModule mod_headers.c>
# Force no caching for dynamic files
<FilesMatch "\.(php|htm|html)$">
	Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
	Header set Pragma "no-cache"
</FilesMatch>
</IfModule>

Link to comment
Share on other sites

.htaccess example (modify the list of file extensions to suite your needs) -

<IfModule mod_headers.c>
# Force no caching for dynamic files
<FilesMatch "\.(php|htm|html)$">
	Header set Cache-Control "no-store, no-cache, must-revalidate, max-age=0"
	Header set Pragma "no-cache"
</FilesMatch>
</IfModule>

 

You guys are "insane."

 

Many thanks!

Link to comment
Share on other sites

if you are using php in the page then you could just try appending the current time to it using the time function

<link ... href="path/to/my.css?version=<?php echo time(); ?>">

this will ensure every upload is unique

 

On advice of counsel, I added this. I guess it is the same thing.


<link type="text/css" rel="stylesheet" href="css/custom.css?v=<?php echo microtime(); ?>"  />

 

We'll see how it does because it is still driving me crazy.

Link to comment
Share on other sites

If forcing your browser to reload the page isn't having an effect, be advised that a lot of web hosts have set the disk cache life-time to a high value, in an attempt to get as many accounts as possible to work on one server.

 

This will prevent the server from operating on your changed source files until the cached versions of your files have become 'stale' and are read again from the disk.

 

Are you still sure you don't simply want to set up a local development system on your computer? There are several all in one packages that normally only take a few minutes to download and install.

Link to comment
Share on other sites

Are you still sure you don't simply want to set up a local development system on your computer? There are several all in one packages that normally only take a few minutes to download and install.

 

I second that! even if it's only for this one site of yours, developing locally is much more fun, because you don't have to wait, it just runs on your own computer. Trust me I am a complete idiot on setting up servers, but than again something like wamp (made for idiots like me ) is set up in about 5 minutes and it works. And from that moment on you can test locally, ones you're done you upload it.

(i use wamp and netbeans works almost out of the box) and you don't need a super computer.

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.