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 have been browsing online more than 4 hours
    today, yet I never found any interesting article like yours.
    It’s pretty worth enough for me. Personally,
    if all webmasters and bloggers made good content as you did,
    the net will be a lot more useful than ever before.

  2. Hello There. I discovered your weblog using msn. That is a really
    smartly written article. I will make sure to bookmark it and come back to read extra of your useful
    information. Thank you for the post. I’ll certainly comeback.

  3. На сайте https://bzdostup.ru/ оформите онлайн-заявку и получите скидку 3% на бетон, растворы. Предприятие в течение длительного времени занимается производством, а также оперативной доставкой продукции. Но также можно воспользоваться и самовывозом. А если вы произведете оплату наличными, то можете рассчитывать на хорошую скидку. Прямо сейчас ознакомьтесь с прайс-листом, чтобы узнать стоимость и заказать товары в требующемся количестве. Бетон отличается всеми важными техническими характеристиками, наделен эталонным качеством.

  4. Hi there i am kavin, its my first time to commenting anyplace, when i read this article i thought i
    could also make comment due to this sensible paragraph.

  5. I do not even know how I ended up here, but I thought this post
    was great. I don’t know who you are but certainly you’re going to a famous blogger if
    you aren’t already ;) Cheers!

  6. Great blog here! Also your website loads up fast!
    What host are you using? Can I get your affiliate link to your host?
    I wish my site loaded up as fast as yours lol

  7. Undeniably consider that that you stated. Your favorite reason appeared to be at the web the simplest thing to have in mind of.
    I say to you, I certainly get irked at the same time as other folks
    consider concerns that they just don’t recognize about.

    You controlled to hit the nail upon the highest and also outlined out
    the entire thing with no need side effect , other people could take a signal.
    Will probably be back to get more. Thank you

  8. Fine way of describing, and nice piece of writing to take information concerning my presentation focus, which i am going to
    deliver in college.

  9. I would like to thank you for the efforts you have put in penning this website.
    I’m hoping to check out the same high-grade blog posts from you later
    on as well. In truth, your creative writing
    abilities has encouraged me to get my own blog now ;)