Web/API/Body/formData

From Get docs
< Web/API‎ | Body


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

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet

formData

Experimental'

Chrome

Full support 60

Edge

Full support ≤79

Firefox Full support 39


Full support 39


Full support 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 support No

Opera

Full support 47

Safari Partial support 10.1

Notes'

Partial support 10.1

Notes'

Notes' From Safari 10.1, the method exists but always rejects with NotSupportedError. See bug 215671.

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

Notes'

Partial support 10.3

Notes'

Notes' From Safari for iOS 10.3, the method exists but always rejects with NotSupportedError. See bug 215671.

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