The method read-only property of the Request interface contains the request's method (GET, POST, etc.)

Syntax

var myMethod = request.method;

Value

A ByteString indicating the method of the request.

Example

In the following snippet, we create a new request using the Request.Request() constructor (for an image file in the same directory as the script), then save the method of the request in a variable:

var myRequest = new Request('flowers.jpg');
var myMethod = myRequest.method; // GET

Specifications

Specification Status Comment
Fetch
The definition of 'method' in that specification.
Living Standard Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support

42

411

Yes

39

342

No

29

283

No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No42 — 46 Yes No No No4.0

1. From version 41: this feature is behind the Experimental Web Platform Features preference. To change preferences in Chrome, visit chrome://flags.

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

3. From version 28: this feature is behind the Experimental Web Platform Features preference.

See also

Document Tags and Contributors

Contributors to this page: fscholz, chrisdavidmills, abbycar, RReverser, Sebastianz, kscarfone
Last updated by: fscholz,