About the Author

author photo

Adam Trachtenberg is the Director of the LinkedIn Developer Network, where he oversees developer relations and marketing for the LinkedIn Platform. Before LinkedIn, Adam worked at eBay in platform product management and marketing. Even earlier, he co-founded Student.Com and TVGrid.com. Adam is the author of PHP Cookbook and Upgrading to PHP 5. He lives in San Francisco.

See All Posts by This Author

Safari, XMLHttpRequest, and WebDAV

Apparently, Safari’s implementation of the XMLHttpRequest object doesn’t support HTTP methods other than GET and POST. If you try to use anything else, say SEARCH, then it’s silently converted to GET.

I guess this is supposed to protect me from doing something wrong, but really it’s just not trusting me to know what I want to do. I hate this. And it’s not as if this is a technical issue. All Safari has to do is insert the string into the HTTP request, just as it’s already doing for GET and POST. There’s no new logic to handle arbitrary methods.

Not suprisingly, smarter browsers, say Firefox, aren’t quite so inhibited.

This has put a bit of a crimp in my plan to write a calendar Dashboard widget that pulls data from Outlook using WebDAV. I can work around this, but I’m not sure if it’s worth the effort. Stupid Apple.

There Are 5 Responses So Far. »

  1. I don’t know if it’s deliberate or just another of the many flaws that you’ll find with xmlHttpRequest as implemented in Safari 1.3/2.0. It fails to return a status code on anything but an HTTP 200 OK response, doesn’t return statusTest of any kind on anything, and getAllResponseHeaders() or getResponseHeader() don’t return anything if the response is not an HTTP 200. Then there’s the issue with senidng multiple requests to the same URL — unless you do something like set a request header for “if-modified-since” it will simply return the cached response from the first request to that URL.

    It is stupid and deliberate, or is it just sloppy and untested?

  2. Dunno about motivations. I hope that as AJAX becomes more widespread, Apple will feel the pressure to make Safari more fully compliant, or they’ll be left out of the conversation.

    I had previously ran into the URL caching bug. I solved it by adding a fake query string to the end, which is hacky to say the least. Especially when it’s a local file. :)

  3. This is an extraordinarily annoying issue in the NSURLRequest class of Cocoa Foundation. It does not only affect Safari but all Cocoa applications which want to do something else but GET and POST.

  4. From a quick search of the WebKit Bugzilla, it appears that Apple is aware of their incomplete implementation of XMLHttpRequest:


    You might want to add a comment specifically about SEARCH support being absent.

  5. Thanks for the pointer to the bug page. I added a comment and put myself on the CC list.