We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE



Request 接口的 mode 只读属性包含请求的模式 (e.g., cors, no-cors, cors-with-forced-preflight, same-origin, or navigate.) 这用于确定跨域请求是否导致有效的响应,以及响应的哪些属性是可读的:

  • same-origin — 如果使用此模式向另外一个源发送请求,显而易见,结果会是一个错误。你可以设置该模式以确保请求总是向当前的源发起的。
  • no-cors — 防止该方法是HEAD,GET或POST以外的其他方法 。If any ServiceWorkers intercept these requests, they may not add or override any headers except for these. In addition, JavaScript may not access any properties of the resulting Response. This ensures that ServiceWorkers do not affect the semantics of the Web and prevents security and privacy issues arising from leaking data across domains.
  • cors — 允许跨域请求,例如访问第三方供应商提供的各种API。 These are expected to adhere to the CORS protocol. Only a limited set of headers are exposed in the Response, but the body is readable.
  • navigate — 支持导航的一个模式。 The navigate value is intended to be used only by HTML navigation. A navigate request is created only while navigating between documents.


var myMode = request.mode;


A RequestMode value.


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 request mode in a variable:

var myRequest = new Request('flowers.jpg');
var myMode = myRequest.mode; // returns "cors" by default


Specification Status Comment
Living Standard Initial definition

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 42.0 (Yes) 39 (39) 未实现


navigate mode 49.0 ? 46 (46) 未实现 ? 未实现
Feature Android Android Webview Edge Firefox Mobile (Gecko) Firefox OS (Gecko) IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support 未实现 49.0 (Yes) 未实现 未实现 未实现 未实现 未实现 49.0
navigate mode 未实现 未实现 ? 未实现 未实现 未实现 未实现 未实现 49.0

See also


 此页面的贡献者: FLYSLOW, xgqfrms-GitHub
 最后编辑者: FLYSLOW,