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. Hello studs! I’m Brandon, and I just discovered this
    next-level gay chat at BubiChat. ️‍

    No cap, I was bored af when I stumbled on this actually fun chatroom.
    Way hotter than those sketchy dating apps!

    At BubiChat, you can:
    Get dirty with jacked guys RIGHT NOW
    No judgment – just down-to-earth dudes
    Stay discreet if you’re just exploring

    Slide into my DMs there and let’s swap stories!

    Who knows we’ll Netflix & chill?

    Pro tip: It’s stupid easy to join – no
    “premium upgrade” scams, just fun guys like us.

    Don’t ghost me, daddy! I’m biting my lip at https://bubichat.com/gay-chat/

    XOXO,
    Brandon

  2. I would like to thank you for the efforts you have put in writing this website.
    I am hoping to check out the same high-grade content from you in the future as well.

    In truth, your creative writing abilities has inspired me to get my own site now ;)

  3. Howdy, i read your blog occasionally and i own a similar one and
    i was just curious if you get a lot of spam feedback? If so how do you protect
    against it, any plugin or anything you can suggest?
    I get so much lately it’s driving me crazy so any assistance is very much appreciated.

  4. Hello there! Quick question that’s totally off topic. Do you know how to make your site mobile friendly?

    My blog looks weird when browsing from my iphone 4.

    I’m trying to find a template or plugin that might be able to correct this
    issue. If you have any suggestions, please share. Many thanks!

    Here is my web page; Packaging Machinery

  5. Hi to every body, it’s my first visit of this web site; this web site contains awesome and
    actually good material in support of visitors.

  6. Hello, i think that i saw you visited my web site so
    i came to “return the favor”.I am trying to find things to improve my website!I suppose its
    ok to use some of your ideas!!

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