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. I think this is one of the most significant info for me. And i am glad reading your article.
    But wanna remark on some general things, The site style
    is wonderful, the articles is really great : D. Good job, cheers

  2. I just had a health salon visit for some therapies, and I have to state, the outcomes were wonderful! Liposuction helped with some great traces, and the microneedling treatment truly improved body appearance medical spa

  3. Дача и огород фермерство и земледелие растения и цветы. Все о доме даче и загородной жизне. Мы публикуем различные мнения статьи и видеоматериалы о даче огороде https://sad-i-dom.com/

  4. Excellent goods from you, man. I’ve understand your stuff previous to and you are just extremely great.
    I actually like what you have acquired here, really
    like what you’re saying and the way in which you say it. You make it
    entertaining and you still care for to keep it sensible.
    I can not wait to read far more from you. This is actually a
    wonderful website.

  5. I had a small leak in my basement that turned into a major water damage problem. Thankfully, I found helpful resources at Servpro of Auburn that guided me through the restoration process.

  6. Greetings from Carolina! I’m bored at work so I decided to check out your website on my iphone during lunch break.
    I love the knowledge you present here and can’t wait to take
    a look when I get home. I’m shocked at how quick your blog loaded
    on my mobile .. I’m not even using WIFI, just 3G .. Anyhow,
    amazing site!