MooTools Depender, Safari, etags and 412 Precondition Failed

/**
* This replaces the default MooTools more Depender.request function to use
* HTTP "get" rather than "post".
*
* When sending requests for files via the depender, I was finding that Safari
* wasn't getting and re-evaluating them the second time I visited the page.
* This was because an etag was sent with each script.
*
* Safari responds to etags properly and adds "If-None-Match" and
* "If-Modified-Since" headers to another request for the same file. This makes
* Apache respond with a 412 status (Precondition Failed) as it should do for
* "post" requests (according to RFC 2616).
*
* Unfortunately Safari doesn't then deal with the 412 as it does with a 304
* (Not Modified). It doesn't grab what it has in the cache and put it in the
* response, it gives you nothing.
*
* For "get" requests, Apache has to respond with a 304, or 200 or whatever, but
* not 412. So we change the request method so we don't have to deal with 412.
*/
Depender.request = function(url, callback){
    new Request.JSON({
        url: url,
        secure: false,
        onSuccess: callback,
        method:'get'
    }).send();
};

24,935 thoughts on “MooTools Depender, Safari, etags and 412 Precondition Failed

  1. Любимые карточные игры на покерок. Новички и профессиональные игроки всё чаще выбирают площадку благодаря её стабильности и удобству. Здесь доступны кэш-игры турниры с большими призовыми и эксклюзивные акции. Интерфейс адаптирован под мобильные устройства а служба поддержки работает круглосуточно.

  2. консультации и онлайн услуги юрист по закону о защите прав потребителей: консультации подготовка претензий и исков представительство в суде. Поможем вернуть деньги заменить товар или взыскать компенсацию. Работаем быстро и по закону.

  3. Gelecekte, indirme koşullarının daha fazla tercih edileceği
    ve kullanıcıların bu türdeki araçlara daha fazla ihtiyaç duyacağı
    öngörülmektedir.

  4. Hello, i believe that i noticed you visited my blog thus i got here to return the choose?.I am trying to find issues to
    improve my site!I suppose its good enough to make use of some of your concepts!!