The formData() method of the Body mixin takes a Response stream and reads it to completion. It returns a promise that resolves with a FormData object.
Note: 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).
Syntax
response.formData()
.then(function(formdata) {
// do something with your formdata
});
Parameters
None.
Return value
A Promise that resolves with a FormData object.
Example
TBD.
Specifications
| Specification | Status | Comment |
|---|---|---|
| Fetch The definition of 'formData()' in that specification. |
Living Standard |
Browser compatibility
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.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
formData | Chrome Full support 60 | Edge Full support ≤79 | Firefox
Full support
39
| IE No support No | Opera Full support 47 | Safari Full support 10 | WebView Android Full support 60 | Chrome Android Full support 60 | Firefox Android No support No | Opera Android Full support 44 | Safari iOS Full support Yes | Samsung Internet Android Full support 8.0 |
Legend
- Full support
- Full support
- No support
- No support
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.
- User must explicitly enable this feature.
- User must explicitly enable this feature.
