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. Энергобум – интернет магазин бытовой техники и электроники. Мы предлагаем широкий ассортимент продукции по доступным ценам. Клиентам вежливое и внимательное отношение гарантируем. Ассортимент регулярно пополняется, поэтому вы точно сможете отыскать желаемый товар на сайте. https://energoboom.ru/ – здесь можно в любое время ознакомиться с условиями оплаты и доставки. Работаем качественно. На нас можно положиться. Найти необходимую технику просто. Используйте строку поиска либо удобный каталог. Ждем вас в Энергобум. Удачных вам приобретений!

  2. Wonderful website. Lots of useful information here.
    I’m sending it to a few buddies ans additionally sharing in delicious.
    And obviously, thanks for your effort!

  3. Hello there, I discovered your blog by the use of Google at the same time as
    searching for a comparable matter, your website got here up, it looks great.
    I have bookmarked it in my google bookmarks.
    Hello there, simply changed into alert to your weblog through Google, and found that it’s truly informative.
    I’m gonna be careful for brussels. I will be grateful when you continue this in future.
    Numerous folks can be benefited from your
    writing. Cheers!

  4. This paragraph is actually a pleasant one it helps new net people, wwho are wishing in favor of blogging.