Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. HTTP
  3. Reference
  4. Headers
  5. Sec-Fetch-Mode

Sec-Fetch-Mode header

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨March 2023⁩.

The HTTPSec-Fetch-Modefetch metadata request header indicates themode of the request.

Broadly speaking, this allows a server to distinguish between requests originating from a user navigating between HTML pages, and requests to load images and other resources.For example, this header would containnavigate for top level navigation requests, whileno-cors is used for loading an image.

Header typeFetch Metadata Request Header
Forbidden request headerYes (Sec- prefix)
CORS-safelisted request headerNo

Syntax

http
Sec-Fetch-Mode: corsSec-Fetch-Mode: navigateSec-Fetch-Mode: no-corsSec-Fetch-Mode: same-originSec-Fetch-Mode: websocket

Servers should ignore this header if it contains any other value.

Directives

Note:These directives correspond to the values inRequest.mode.

cors

The request is aCORS protocol request.

navigate

The request is initiated by navigation between HTML documents.

no-cors

The request is a no-cors request (seeRequest.mode).

same-origin

The request is made from the same origin as the resource that is being requested.

websocket

The request is being made to establish aWebSocket connection.

Examples

Using Sec-Fetch-Mode

If a user clicks on a page link to another page on the same origin, the resulting request would have the following headers (note that the mode isnavigate):

http
Sec-Fetch-Dest: documentSec-Fetch-Mode: navigateSec-Fetch-Site: same-originSec-Fetch-User: ?1

A cross-site request generated by an<img> element would result in a request with the following HTTP request headers (note that the mode isno-cors):

http
Sec-Fetch-Dest: imageSec-Fetch-Mode: no-corsSec-Fetch-Site: cross-site

Specifications

Specification
Fetch Metadata Request Headers
# sec-fetch-mode-header

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp