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. Foothills Paving & Maintenance Inc did an amazing job on my driveway paving!
    I love my new driveway thanks to Foothills Paving & Maintenance Inc!
    Foothills Paving & Maintenance Inc provides excellent driveway paving services!
    My driveway never looked Paving companies near Wheat Ridge

  2. This is very interesting, You are a very skilled blogger.

    I have joined your feed and look forward to seeking more of your excellent
    post. Also, I’ve shared your website in my social
    networks!

  3. Partnering with BlckPanda Creative Dallas was one of the best decisions I’ve made for my business! My Google rankings have soared—check out their service at seo company .

  4. I used to be suggested this website by my cousin. I’m no longer positive whether this put up is written via him as no
    one else understand such precise approximately my trouble.
    You’re wonderful! Thank you!

  5. Just wish to say your article is as surprising. The clearness on your publish is just nice
    and i can assume you are a professional in this subject.
    Well with your permission let me to grasp your RSS feed to keep up to date with approaching post.
    Thank you one million and please carry on the enjoyable work.

  6. Hello, I do believe your blog could possibly be having browser compatibility issues.
    When I take a look at your site in Safari, it looks fine however, if opening in Internet Explorer,
    it has some overlapping issues. I merely wanted to give you a quick heads up!

    Apart from that, wonderful site!