Can a 303 response be exposed to the javascript layer?
When making an ajax request and a response code of 303 is returned, the browser automatically redirects to the uri provided in the Location header without notifying the javascript layer. This make sense for thing like a 301 or 302. But in the RFC-2616 it states "The new URI is not a substitute reference for the originally requested resource."
As such, to me it doesn't make sense that if I request resource A, that I will be given resource B without any way of knowing that my request for resource A redirected to resource B. Instead I feel that after resource A returns a 303, I should be given the option to intercept it and decide if I want to retrieve resource B. I don't have a problem with the default being automatically following, but I think I should be able to checkout the situation and make a decision here since we are talking about 2 different resources which are not substitutes.
Svi odgovori (1)
Hmm, according to the person who wrote the following Wikipedia article, the expected behavior might have changed in a later RFC:
https://en.wikipedia.org/wiki/HTTP_303
Anyway, this behavior isn't something that can be addressed very well on this support forum.
You do have the option to check the responseURL property and compare that with your requested URL to detect the redirect after the fact and decide what to do with the response in light of that. See:
https://developer.mozilla.org/docs/Web/API/XMLHttpRequest/responseURL
Otherwise, you might try the following forum:
https://discourse.mozilla.org/c/firefox-development
Or file a new bug, pointing out any differences between Firefox's implementation and other browsers: