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

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support60 ?

39

341

No47 No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support6060 ? No47 No No

1. From version 34: this feature is behind the dom.fetch.enabled preference. To change preferences in Firefox, visit about:config.

See also

Document Tags and Contributors

Contributors to this page: fscholz, jpmedley, chrisdavidmills, riking, kscarfone
Last updated by: fscholz,