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. Walter’s BBQ Southern Kitchen serves the best brunch I’ve ever had in Pittsburgh PA!
    The brunch at Walter’s BBQ Southern Kitchen is absolutely delightful and always makes my weekend better Brunch Near Me

  2. Open Wide La Jolla Dentistry provides exceptional dental care with a smile!
    I had a fantastic experience at Open Wide La Jolla Dentistry, the best dentist near me!
    The staff at Open Wide La Jolla Dentistry are truly friendly and professional cosmetic dentistry

  3. I am really loving the theme/design of your site. Do you ever run into any browser compatibility problems?
    A handful of my blog readers have complained about my site not operating correctly in Explorer but
    looks great in Firefox. Do you have any solutions to help fix this problem?

  4. Excellent post. Keep writing such kind of info
    on your site. Im really impressed by your site.

    Hi there, You’ve performed an incredible job. I will definitely digg it and personally recommend to my friends.
    I am confident they’ll be benefited from this site.

  5. What i don’t understood is if truth be told how you’re now not really a lot more neatly-appreciated than you might be right now.
    You are very intelligent. You understand thus significantly
    relating to this topic, produced me in my opinion imagine it from a lot
    of numerous angles. Its like women and men aren’t interested except
    it’s one thing to accomplish with Woman gaga! Your individual stuffs great.

    At all times deal with it up!

  6. Wow, AquaSculpt sounds like the perfect combo of skincare and body care!
    Love that it hydrates deeply and helps with sculpting—such a
    bonus to get both results from one product. Definitely curious
    to try it out for a more refreshed and toned look!

  7. Excellent article! Finding a trustworthy# #anykeyword## can save you a lot of money, especially in times of need. For those unanticipated leaks or sandals, it’s always best to have a local locksmith on call right away plumber