AJAX标题(Firefox与Chrome)

我遇到了一个涉及AJAX调用的有趣情况,并想知道是否有人可以提供某种解释。

1. $.ajax({ 2. type: "POST", 3. headers: { 4. "Content-Type": "application/json" 5. "authToken": //auth token 6. }, 7. url: "/api", 8. data: JSON.stringify(dataFormValues) 9. }) 10. .done(function(data) { 11. //do the next thing 12. }) 13. .error(function(data) { 14. //show error message 15. }); 

这很有效,直到我们在Firefox中测试。 显然,如果没有将第4行修改为以下内容,这将无法在Firefox中运行:

 .... 4. "Content-Type": "application/json;charset=utf-8" .... 

然后,一旦转向Internet Explorer(IE 11)中的测试,我注意到它甚至不关心标题是什么; 无论是否在标题中使用utf-8,它都可以使呼叫完美无缺。

有人知道Firefox vs Chrome的UTF-8标头限制吗?