Mozilla Firefox : Cache dauerhaft abschalten (browser.cache.disk.enable)

Problem:

Der Cache des Browsers speichert viele Inhalte zwischen, diese können dann bei einem Wiederaufruf viel schneller dargestellt werden, weil sie nicht aus dem Internet geladen werden müssen. Wenn man jedoch eine Webseite erstellt, muss man viele Änderungen immer wieder testen. Beim Klick auf Neu laden bzw. aktualisieren passiert aber oft gar nichts. Man kann keine Änderung feststellen.

Lösung:

Firefox bietet die Möglichkeit, über die Adresszeile viele Einstellungen des Browsers zu ändern.

Dazu gibt man einfach den Befehl „about:config“ natürlich ohne die Anführungsstriche in die Leiste ein.

Nun muss man nur die Zeile browser.cache.disk.enable mit einem Klick auf false setzen und schon wird der Cache nicht genutzt.

 

Nun funktioniert es nicht immer. Ich wollte durch das Abschalten des Cache erreichen, dass ab diesem Zeitpunkt JEDE Anfrage vom Server neu geholt wird. Pustekuchen.

Habe darauf gehofft, dass ich im Firebug keine Statusmeldungen 304 Not Modified mehr sehe. Hier ist das Ergebnis nach dem Abschalten des Cache, die Datei wird definitiv nicht neu geholt.

Ich vermute, dass es an dem HTTP Header If-Modified-Since liegt, der sich im GET Request befindet.

Das nächste Bild zeigt, dass der Server einen GET bekommt und definitiv mit 304 antwortet.

Hier ist die mögliche Erklärung : Quelle RFC2616

If-Modified-Since

The If-Modified-Since request-header field is used with a method to make it conditional: if the requested variant has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body.

If-Modified-Since = „If-Modified-Since“ „:“ HTTP-date An example of the field is: If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT A GET method with an If-Modified-Since header and no Range header requests that the identified entity be transferred only if it has been modified since the date given by the If-Modified-Since header.

The algorithm for determining this includes the following cases:

a) If the request would normally result in anything other than a 200 (OK) status, or if the passed If-Modified-Since date is invalid, the response is exactly the same as for a normal GET. A date which is later than the server’s current time is invalid.

b) If the variant has been modified since the If-Modified-Since date, the response is exactly the same as for a normal GET.

c) If the variant has not been modified since a valid If- Modified-Since date, the server SHOULD return a 304 (Not Modified) response.

Fazit:

Es ist mir also nicht gelungen nach dem Abschalten des lokalen Caches die Dokumente vom Server neu zu holen.

 

Linkhinweis : http://www.prozesse-und-systeme.de/servletCaching.html