This content has been marked as final. Show 4 replies
> I have a HTML page on that includes a .js file. On changing the .js file, I
>sometimes need to CTRL+F5 in order to get the new contents of the .js file
>included on the page and the normal F5 doesn't work.
> Is this normal
Yes. This may happen with all cacheable resources: JS, CSS, images,
static HTML pages ...
>or is there something I can add to automate this load? We want
>customers to see the new contents and not the old .js contents.
They will see it, either immediately or after a few hours, dependent on
the browser configuration. Usually cached resources will be checked
again automatically after a while to see if they are still fresh or if
they were modified on the server.
There are also ways to control the caching behaviour with HTTP headers,
but this requires some modifications in the server configuration, for
example in an .htaccess file.
So if I set "expires" within the .htacess to say 1 month from now(we have monthly updates), as long as the web server date is correct the cache will be refreshed every month?
>So if I set "expires" within the .htacess to say 1 month from now(we
>have monthly updates), as long as the web server date is correct the
>cache will be refreshed every month?
That's how it should be. In this case you explicitly tell the browsers
(and other clients) that the received resource should be considered
fresh for the next month, so there's no need for the browser to check
back with the server earlier. It will always serve the resource directly
from its own cache, unless you force a reload with ctrl-F5 or clear the
cache (dependent on their configuration some browsers might still
contact the server even if the expiration date is not reached yet).
But using an Expires header is just one of the various ways to control
I added into my .htaccess:
Expires: Fri, 30 Oct 1998 14:19:41 GMT
and got this message:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, firstname.lastname@example.org and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
What have I done wrong? I thought all accesses would be refreshed and not use the cache?