Glaubs mir, da gibts keine PHP
Und ansonsten reicht das:
1. Prototype einbinden (ich hab die aktuelle, also 1.6.0.3)
2. Ajax.Request erzeugen:
1: 2: 3: 4: 5: 6: 7: 8: 9:
| new Ajax.Request('some/file.txt', { method:'get', asynchronous: false, evalJS: false, requestHeaders: [ 'if-modified-since', 'Sat, 1 Jan 2000 00:00:00 GMT'], onSuccess: function(response) { } }); |
3. Rumprobieren...
Mal mit und mal ohne die Headers probieren und dann im Network-Tab vom Firebug gucken was passiert. Oder eben nicht passiert: das erste mal nach Cache-Löschung klappt immer normal, danach wird der Request gar nicht mehr abgeschickt sondern wird direkt ausm Cache bedient. Alternativ zum Header könnte ich auch einen zufälligen Query-String an die URL anhängen, aber das ist ja auch nicht Sinn der Sache.
EDIT: interessant. Es hängt auch noch vom content-type der Daten ab, oder so.
Ich hab mal ein kleines Test-Projekt geschraubt,
hier ist es. Das ganze gibts im Anhang nochmal als zip.
Man sieht, dass das Caching-Verhalten relativ chaotisch ist. Das einzige was geht, ist das "immer neu laden" wenn man den Cache ganz ausschaltet, sei es per WebDeveloperToolbar oder Request-Header
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."