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. I’ve been surfing on-line more than 3 hours lately, but
    I never discovered any interesting article like yours.

    It is beautiful worth sufficient for me. Personally,
    if all webmasters and bloggers made just right content as you did, the web will probably be much more useful than ever before.

  2. What i don’t understood is in reality how you are now not really a lot more
    smartly-preferred than you may be now. You are so
    intelligent. You realize thus significantly with regards to this topic, produced me personally consider it from so many varied angles.
    Its like women and men don’t seem to be interested
    except it’s something to accomplish with Lady gaga!
    Your own stuffs great. At all times handle it up!

  3. Компания «AXIONT» предлагает высокотехнологичные, уникальные цифровые решения, которые станут оптимальными для развития вашего бизнеса. В настоящий момент эта компания считается лидером в своей сфере и предлагает несколько подсистем, методик и решений. На сайте https://axiont.ru уточните то, какими услугами вы сможете воспользоваться, если обратитесь в эту популярную компанию. Компания смогла реализовать почти 50 проектов, внедрила 18 собственных разработок, более 17 лет находится на рынке и оказывает услуги на профессиональном уровне.

  4. Howdy! This is my first visit to your blog!
    We are a group of volunteers and starting a new project in a community in the same niche.
    Your blog provided us valuable information to work on.
    You have done a extraordinary job!

  5. I’ll immediately grab your rss feed as I can’t to find your
    email subscription hyperlink or newsletter service. Do you’ve any?
    Please let me recognise in order that I could subscribe.
    Thanks.