dotnet/runtime · error · Error
This browser doesn't support fetch API. Please use a modern…
Error message
This browser doesn't support fetch API. Please use a modern browser. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms
What it means
Thrown by verifyEnvironment in http.ts when not running on NodeJS (i.e. a browser) and either globalThis.fetch or globalThis.AbortController is missing. Modern browsers all provide both; this fires only on obsolete browsers (old WebView, legacy mobile WebViews, IE) or in unusual embedded web runtimes that lack the Fetch API.
Solutions
- Use a supported modern browser (see the linked supported-platforms doc).
- If you must support the old engine, polyfill fetch and AbortController with whatwg-fetch / abortcontroller-polyfill before the runtime starts.
- Avoid HttpClient in code paths that run on unsupported browsers.
Example fix
// before: no fetch in old WebView // after: load polyfills before dotnet runtime import 'whatwg-fetch'; import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only';
Defensive patterns
Strategy: type-guard
Validate before calling
// before using HttpClient from the wasm runtime in a browser
if (typeof globalThis.fetch !== 'function' || typeof globalThis.AbortController !== 'function') {
// load whatwg-fetch and abortcontroller-polyfill, or show 'unsupported browser'
} Type guard
function browserSupportsFetch(): boolean {
return typeof globalThis.fetch === 'function' && typeof globalThis.AbortController === 'function';
} Prevention
- Feature-detect fetch and AbortController before enabling HTTP scenarios.
- Document minimum browser versions to users.
- Provide a polyfill bundle for legacy WebView targets.
When it happens
Trigger: Loading the .NET wasm runtime in Internet Explorer or an old WebView that lacks fetch/AbortController; a custom embedded browser shell that did not expose Fetch API; HttpClient used in an environment that intentionally disabled fetch.
Common situations: Targeting legacy browsers; running inside an old Cordova/Capacitor WebView; corporate locked-down browsers.
Related errors
- This browser doesn't support fetch API. Please use a modern…
- Please install `node-fetch` and `node-abort-controller` npm…
- Please install `node-fetch` and `node-abort-controller` npm…
- URLSearchParams is supported
- BrowserHttpWriteStream.Rejected
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/94ce940277f664be.
Report an issue: GitHub.
Appendix: source
Thrown at src/mono/browser/runtime/http.ts:20
// The .NET Foundation licenses this file to you under the MIT license.
import BuildConfiguration from "consts:configuration";
import { wrap_as_cancelable_promise } from "./cancelable-promise";
import { ENVIRONMENT_IS_NODE, loaderHelpers, mono_assert } from "./globals";
import { assert_js_interop } from "./invoke-js";
import { MemoryViewType, Span } from "./marshal";
import type { VoidPtr } from "./types/emscripten";
import { ControllablePromise } from "./types/internal";
import { mono_log_debug } from "./logging";
function verifyEnvironment () {
if (typeof globalThis.fetch !== "function" || typeof globalThis.AbortController !== "function") {
const message = ENVIRONMENT_IS_NODE
? "Please install `node-fetch` and `node-abort-controller` npm packages to enable HTTP client support."
: "This browser doesn't support fetch API. Please use a modern browser. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms";
throw new Error(message);
}
}
function commonAsserts (controller: HttpController) {
assert_js_interop();
mono_assert(controller, "expected controller");
}
export function http_wasm_supports_streaming_request (): boolean {
// Detecting streaming request support works like this:
// If the browser doesn't support a particular body type, it calls toString() on the object and uses the result as the body.
// So, if the browser doesn't support request streams, the request body becomes the string "[object ReadableStream]".
// When a string is used as a body, it conveniently sets the Content-Type header to text/plain;charset=UTF-8.
// So, if that header is set, then we know the browser doesn't support streams in request objects, and we can exit early.
// Safari does support streams in request objects, but doesn't allow them to be used with fetch, so the duplex option is tested, which Safari doesn't currently support.
// See https://developer.chrome.com/articles/fetch-streaming-requests/
if (typeof Request !== "undefined" && "body" in Request.prototype && typeof ReadableStream === "function" && typeof TransformStream === "function") {
let duplexAccessed = false;View on GitHub (pinned to 60108ba66e)