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. Love this kind of content. It’s amazing how
    non-invasive methods like sound therapy can support mental
    health and performance. The Brain Song seems like a great option for people who want a natural way to boost
    clarity and mood.

  2. Thanks for the useful suggestions. Discover more at https://www.google.com/maps/dir/septic%20tank+service+near+me,+6119+Highview+Dr,+Fort+Wayne,+IN+46818,+United+States/J+%26+S+Liquid+Waste+Services+Inc.,+Option+Pass,+Fort+Wayne,+IN,+USA/@41.1351628,-85.1961574,17z/data=!3m1!4b1!4m14!4m13!1m5!1m1!1s0x8815e377d8d34ca9:0xea8783a077d87bf3!2m2!1d-85.190384!2d41.134199!1m5!1m1!1s0x8815e178f989e1a5:0x9850974a022ec63b!2m2!1d-85.1971098!2d41.1384079!3e0!5m1!1e3?entry=ttu&g_ep=EgoyMDI1MDYwMy4wIKXMDSoASAFQAw%3D%3D .