XmlHttpRequest.onload not called

前端 未结 3 1980
星月不相逢
星月不相逢 2021-02-20 10:39

I\'m playing around with this XmlHttpRequest thing. In some tutorials and books, it is the onload function the one that is called when the request is d

3条回答
  •  情书的邮戳
    2021-02-20 11:09

    The onload handler won't be called for yet another reason, I'm adding it here just so it can be helpful to someone else referencing this page.

    If the HTTP response is malformed, the onload handler will not be called either. For example, a plaintext response of 10 bytes that advertises a length of 14 in Content-Length header will not invoke the onload handler. I wasted hours on client code before I start to replace back-end units with test stubs.

提交回复
热议问题