Response.formData()

The formData() method of the Response interface 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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
formData
60
79
39
No
47
14.1
10.1
The method exists but always rejects with NotSupportedError. See bug 215671.
60
60
39
44
14.5
10.3
The method exists but always rejects with NotSupportedError. See bug 215671.
8.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Response/formData