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 there! Someone in my Myspace group shared this website with
    us so I came to check it out. I’m definitely enjoying the information. I’m bookmarking and will
    be tweeting this to my followers! Outstanding blog and
    outstanding style and design.

  2. What i don’t realize is actually how you are no longer actually a lot more neatly-appreciated than you may be
    now. You’re very intelligent. You already know therefore significantly
    in relation to this matter, made me in my opinion consider it from a lot of numerous angles.

    Its like women and men are not fascinated except it’s something to
    accomplish with Woman gaga! Your personal stuffs outstanding.

    At all times deal with it up!

  3. hello!,I really like your writing very so much! percentage we keep up a correspondence more about
    your post on AOL? I require an expert on this area to unravel my problem.
    May be that is you! Looking ahead to peer you.

  4. Woah! I’m really digging the template/theme of this website.
    It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between superb usability and visual appeal.
    I must say you’ve done a very good job with this. Also, the blog loads super quick for me
    on Opera. Superb Blog!

  5. Hello! I just wanted to ask if you ever have any problems with hackers?
    My last blog (wordpress) was hacked and I ended up losing a few months of hard work due to no data backup.
    Do you have any solutions to prevent hackers?