#723 bug

Ajax.PeriodicalUpdater and http cache control

Reported by bubbatls | June 24th, 2009 @ 05:42 PM

if the server (as mine) use the http cache control headers like Etag/Last-Modified/Expires
The PeriodicalUpdater don't care and update the html with its old value.

This would be an Improvment in performance if the request was not done or when no change the update of html was not done.

to do this well I've made a class like that :
@@@javascript Ajax.Ressource = Class.create({

this.uri = uri;
this.options = options;

}, dontRefreshBefore:new Date(0), refresh:function(){

if(this.dontRefreshBefore>new Date()) return;
var opt = Object.extend({},this.options);
opt = Object.extend(opt,{
    this.headers['If-None-Match'] = response.getHeader('Etag');
this.headers['If-Modified-Since'] = response.getHeader('Last-modified');
var expire = response.getHeader('Expires');
      var expirationdate = Date.parse(expire);
      var now = Date.parse(response.getHeader('Date'));
      this.dontRefreshBefore=new Date()+(expirationdate-now);         
    //TODO add header etag
new Ajax.Request(this.uri,opt);


and my own Updater using this Ajax.Ressource.

But maybe its worth being putted in prototype and in the PeriodicalUpdater.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

People watching this ticket