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. Maximum Pest Control provided exceptional service, completely eliminating our pest problem in just one visit!
    I’m so impressed with the pest control service from Maximum, they were professional and thorough throughout the entire process Ant control specialists

  2. Curious whether others experienced difficulties navigating complexities inherent within processes involved selecting appropriate representatives effectively assuring desired outcomes achieved consistently across board mutually beneficially thereafter life insurance

  3. Hello there! I know this is kinda off topic but I’d figured
    I’d ask. Would you be interested in exchanging links or
    maybe guest authoring a blog post or vice-versa? My website
    goes over a lot of the same topics as yours and I feel we could greatly benefit from each other.

    If you happen to be interested feel free to shoot me an email.
    I look forward to hearing from you! Great blog by the way!