Setting XMLHttpRequest.responseType forbidden all of a sudden?

前端 未结 4 1786
谎友^
谎友^ 2020-12-03 21:05

I\'ve been using synchronous XMLHttpRequest with responseType set to \"arraybuffer\" for quite a while to load a binary file and wait until it is loaded. Today, I got this e

4条回答
  •  情书的邮戳
    2020-12-03 21:30

    This is correct behaviour, as defined in the Specification of XMLHttpRequest:

    When set: throws an "InvalidAccessError" exception if the synchronous flag is set and there is an associated XMLHttpRequest document.

    The responseType property cannot be set when the XMLHttpRequest is not async, that is, synchronous. Setting the third parameter of open to false causes the request to be synchronous.

提交回复
热议问题