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 |
FetchThe 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.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Chrome
Full support 60 |
Edge
Full support ≤79 |
Firefox Full support 39 Full support 39 Full support 34 Disabled' From version 34: this feature is behind the |
IE
No support No |
Opera
Full support 47 |
Safari Partial support 10.1 Partial support 10.1 Notes' From Safari 10.1, the method exists but always rejects with |
WebView Android
Full support 60 |
Chrome Android
Full support 60 |
Firefox Android
No support No |
Opera Android
Full support 44 |
Safari iOS Partial support 10.3 Partial support 10.3 Notes' From Safari for iOS 10.3, the method exists but always rejects with |
Samsung Internet Android
Full support 8.0 |
Legend
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- Experimental. Expect behavior to change in the future.'
- Experimental. Expect behavior to change in the future.
- See implementation notes.'
- See implementation notes.
- User must explicitly enable this feature.'
- User must explicitly enable this feature.
See also
Body.formData() by Mozilla Contributors is licensed under CC-BY-SA 2.5.