Sec-Fetch-Mode
When a browser sends a request, the Sec-Fetch-Mode request header describes how the fetch was initiated, distinguishing navigations from API calls and cross-origin resource loads.
Usage
The Sec-Fetch-Mode header is part of the Fetch Metadata Request Headers specification. Browsers set this header automatically on every outgoing request to a potentially trustworthy URL, which covers HTTPS endpoints and localhost. The value describes the fetch mode, which determines how the browser handles the response and whether CORS rules apply.
Servers use Sec-Fetch-Mode to distinguish between
navigation requests (a user clicking a link), same-origin
API calls, cross-origin resource loads, and
WebSocket upgrade requests. This information helps
enforce security policies on the server side. A server
hosting a JSON API expects requests with cors or
same-origin mode and rejects requests arriving with
navigate because navigations to an API endpoint indicate
unintended access patterns. The same server accepts
requests without the header, since older browsers,
command-line tools, and search crawlers send no Fetch
Metadata. The Sec-Fetch-Site article
holds a worked resource isolation policy built on the
four headers.
The header works together with Sec-Fetch-Dest, Sec-Fetch-Site, and Sec-Fetch-User to provide full context about each incoming request.
Directives
cors
The request follows the CORS protocol. The
browser checks the response headers and sends a preflight
first when the request uses a method or header outside
the safelist. fetch() defaults to this mode, so
same-origin and cross-origin calls alike produce
the value, alongside XMLHttpRequest operations. Module
scripts loaded through <script type="module"> always
use this mode, and a crossorigin attribute on
<script>, <link>, <img>, or <video> switches
those loads from no-cors to cors as well. A script
request arriving with cors is usually one of these two
cases.
navigate
The request is a navigation between documents. Clicking
a link, submitting a form, typing a URL in the address
bar, and using window.location produce this value.
Navigations target a top-level document, a frame, or an
<object> or <embed> element.
no-cors
The request is made without CORS enforcement. Image
loads through <img>, stylesheet loads through
<link>, and classic script loads through <script>
send this value by default, whatever the destination
origin. Adding a crossorigin attribute to the element
moves the load to cors.
same-origin
The request targets the same origin as the
page making the request. A cross-origin URL under
this mode fails as a network error before any
request leaves the browser. Fetch API
calls with mode: "same-origin" produce this value.
websocket
The request initiates a WebSocket connection. The browser sets this mode during the WebSocket handshake when upgrading from HTTP to the WebSocket protocol.
Example
A user clicks a link to navigate to a page on the same site. The browser sends all four fetch metadata headers.
Sec-Fetch-Mode: navigate
Sec-Fetch-Dest: document
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
A JavaScript fetch() call to a cross-origin API
triggers CORS mode.
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Sec-Fetch-Site: cross-site
A cross-origin image loaded through an <img> tag uses
no-cors mode.
Sec-Fetch-Mode: no-cors
Sec-Fetch-Dest: image
Sec-Fetch-Site: cross-site
Crawlers and Sec-Fetch-Mode
Googlebot and the other main search crawlers send no
Sec-Fetch-Mode, while crawlers built on a browser
engine send navigate on page requests. A server rule
that requires the header blocks indexing, so policies
allow requests without it. The
Sec-Fetch-Site article covers which
crawlers send Fetch Metadata.
Verified crawler probe
Probe data from verified crawler traffic (November 2026 snapshot) shows which bots send Sec-Fetch-Mode when requesting pages. Yes marks the header on at least nine of ten sampled requests from the bot, Sometimes marks a smaller share, and No marks absence.
| Crawler | Sends Sec-Fetch-Mode |
|---|---|
| Amazonbot | No |
| Applebot | No |
| Baiduspider | No |
| Bingbot | No |
| ClaudeBot | No |
| DuckDuckBot | No |
| GPTBot | No |
| Googlebot | No |
| Googlebot (smartphone) | No |
| Googlebot-Image | No |
| Meta-ExternalAgent | Sometimes |
| Meta-WebIndexer | Yes |
| OAI-SearchBot | No |
| PerplexityBot | Sometimes |
| SeznamBot | No |
| YandexBot | No |
| YandexFavicons | No |
See also
- Fetch Metadata Request Headers (W3C)
- Sec-Fetch-Dest
- Sec-Fetch-Site
- Sec-Fetch-User
- Sec-Fetch-Storage-Access
- Cors
- HTTP headers