Am 15.02.2013 11:07, schrieb Ján Máté:
On Feb 15, 2013, at 9:57 AM, Sven Anders <anders@anduras.de mailto:anders@anduras.de> wrote:
Hmmm?! Copying the .ics file isn't a solution (only a temporary workaround).
But I do not understand. The OPTIONS preflight request succeeded (even if it's empty). So why does it not work? Is a valid answer expected from the preflight request before the GET request is sent? If so, why can we not ignore it? Is this hard coded in jquery?
It not works because the OPTIONS request is send directly by the browser (not jQuery/client). The problem is that if you want to make a cross-domain query you are VERY limited. For example you can make a GET query but ONLY if that query uses "simple headers" (see http://www.w3.org/TR/cors/#simple-header):
/*A header is said to be a simple header if the header field name is an ASCII case-insensitive match for Accept, Accept-Language, or Content-Language or if it is anASCII case-insensitive match for Content-Type and the header field value media type (excluding parameters) is an ASCII case-insensitive match for application/x-www-form-urlencoded, multipart/form-data, or text/plain.*/
The first problem is that we use the X-client header (it will be removed in the next version) and also a non-simple content type (also will be fixed in the next version to 'text/plain'). The second problem is, that jQuery adds additional (non-simple) headers and we cannot fix this.
If the browser detects the non-simple header situation (before it makes a request itself) it sends an OPTIONS (preflight) request. The result from this request is handled inside the browser - not Javascript. That request asks the remote server for allowed URLs and allowed headers to make cross-domain requests. And because the Mozilla server not sends the required headers (it is OK), the browser (not jQuery) refuse to make the real GET request.
Ok, I think I understand the problem. But I wonder, that jQuery doesn't allow to make simple queries... But it should be possible to use the plain XMLHttpRequest object, right?
I did a quick check and the fix from the bug report is still in the code. But I did not find this code anywhere in the used jquery library?!
Maybe because the final code is minified.
Yes, I saw this. But I seem to missed the change in the file...
The comment says: "(it can always be set on a per-request basis or even using ajaxSetup)" Is it turned on anywhere in the code, even if we do not want it here???
I don't know, if you are interested to fix this problem download the non-minified version of jQuery and try to debug it.
I'll wait for the next version and try it then...
Regards Sven