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. An impressive share! I have just forwarded this onto a colleague who has been conducting a little research on this.
    And he actually ordered me breakfast because I stumbled upon it for him…
    lol. So let me reword this…. Thank YOU for the meal!! But yeah, thanks for spending the
    time to talk about this topic here on your web site.

  2. Greetings! Very useful advice in this particular post!
    It’s the little changes which will make the largest changes.
    Thanks a lot for sharing!

  3. Definitely imagine that which you stated. Your favourite
    reason appeared to be at the web the simplest factor
    to be mindful of. I say to you, I certainly get annoyed whilst other folks think about concerns that they plainly
    don’t realize about. You managed to hit the nail upon the highest and also
    defined out the entire thing without having side effect , people could take a signal.

    Will likely be back to get more. Thanks

  4. Hey there, I think your website might be having
    browser compatibility issues. When I look at your blog site in Opera,
    it looks fine but when opening in Internet Explorer,
    it has some overlapping. I just wanted to give you a quick heads
    up! Other then that, very good blog!

  5. Love how engaging yet informative this impressively written piece is – will be coming back for future posts without doubt  at  # anyKeyboard# zik88

  6. Thank you for the auspicious writeup. It in fact was a amusement account it.
    Look advanced to far added agreeable from you! By the
    way, how could we communicate?

  7. Virtual workshops allow passionate individuals share talents effectively- what workshop would interest YOU next??? Explore opportunities together:#anything_keyword# zik88

  8. Amazing blog! Is your theme custom made or did you download it from somewhere?
    A theme like yours with a few simple tweeks would really make my blog shine.
    Please let me know where you got your theme.
    Cheers