formData() 方法在 Body mixin takes a 响应 stream and reads it to completion. It returns a promise that resolves with a FormData 对象。

注意 : This is mainly relevant to service workers . If a user submits a form and a service worker intercepts the request, you could for example call formData() on it to obtain a key-value map, modify some fields, then send the form onwards to the server (or use it locally).

句法

response.formData()
.then(function(formdata) {
  // do something with your formdata
});
					

参数

None.

返回值

A Promise that resolves with a FormData 对象。

范例

TBD.

规范

规范 状态 注释
Fetch
The definition of 'formData()' in that specification.
实时标准

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. 更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
formData Chrome 60 Edge ≤79 Firefox 39
39
34 Disabled
Disabled From version 34: this feature is behind the dom.fetch.enabled preference. To change preferences in Firefox, visit about:config.
IE No Opera 47 Safari 10 WebView Android 60 Chrome Android 60 Firefox Android No Opera Android 44 Safari iOS Yes Samsung Internet Android 8.0

图例

完整支持

完整支持

不支持

不支持

实验。期望将来行为有所改变。

实验。期望将来行为有所改变。

用户必须明确启用此特征。

用户必须明确启用此特征。

另请参阅

元数据

  • 最后修改: