翻譯不完整。 請幫助我們翻譯這篇文章!


The XMLHttpRequest.responseType property is an enumerated value that returns the type of the response. It also lets the author change the response type to one "arraybuffer", "blob", "document", "json", or "text". If an empty string is set as the value of responseType, it is assumed as type "text".

Setting the value of responseType to "document" is ignored if done in a Worker environment. When setting responseType to a particular value, the author should make sure that the server is actually sending a response compatible to that format. If the server returns data that is not compatible to the responseType that was set, the value of response will be null. Also, setting responseType for synchronous requests will throw an InvalidAccessError exception.

The values supported by responseType are the following:

Value Data type of response property
"" DOMString(此為預設值)
"arraybuffer" ArrayBuffer
"blob" Blob
"document" Document
"json" JavaScript object, parsed from a JSON string returned by the server
"text" DOMString

FireFox 專用;允許在請求尚在進行中就開始接收已取得的 Blob 資料,所以能夠在 progress 事件處理器中就提早開始取得資料進行作業。


類似於 "text",但為串流形式,所以只有在 "progress" 事件觸發時才可以取得資料,而且資料只包含到最後一次 "progress" 事件觸發時的狀態。

當 "progress" 事件下會回傳字串資料,其餘則會回傳 null

此模式目前為 FireFox 專用。


FireFox專用;類似於 "arraybuffer",但為串流形式,所以只有在 "progress" 事件觸發時才可以取得資料,而且資料只包含到最後一次 "progress" 事件觸發時的狀態。

在非 "progress" 事件下會回傳 null

此模式目前為 FireFox 專用。

"ms-stream" Indicates that the response is part of a streaming download. It is supported only for download requests. This mode is available only in Internet Explorer.


Specification Status Comment
XMLHttpRequest Living Standard WHATWG living standard


We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 31 12 12 18 7.1
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support 4.4.1 55 50 ? ? ?