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. Hi! I know this is kinda off topic but I was wondering if you knew where I could
    find a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having difficulty finding one?
    Thanks a lot!

  2. After looking into a number of the articles on your site, I seriously
    like your way of writing a blog. I book-marked it to
    my bookmark website list and will be checking back in the
    near future. Please check out my web site as well and let me
    know what you think.

  3. My relatives always say that I am wasting my
    time here at net, but I know I am getting knowledge all the time by reading such fastidious posts.

  4. I’m thrilled with the service from BlckPanda Creative Dallas! My Google ranking has boosted my business tremendously—what a difference it makes! Discover how they did it at seo company .

  5. you’re in reality a good webmaster. The web site loading
    pace is incredible. It seems that you are doing any unique trick.
    Also, The contents are masterwork. you’ve
    done a fantastic process on this topic!

  6. When someone writes an article he/she maintains the idea of a user
    in his/her brain that how a user can know it. So that’s why this
    article is outstdanding. Thanks!