GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • MDN
  • HTML: Markup language
  • Elements
  • Global attributes
  • Attributes
  • See all…
  • Responsive images
  • HTML cheatsheet
  • Date & time formats
  • See all…
  • SVG
  • MathML
  • XML
  • CSS: Styling language

This view

  • Original page
  • New address

GeezerVison is showing developer.mozilla.org — Request: keepalive property - Web APIs | MDN

Request: keepalive property

Baseline 2024
Newly available

Since November 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

  • See full compatibility
  • Learn more

The keepalive read-only property of the Request interface contains the request's keepalive setting (true or false), which indicates whether the browser will keep the associated request alive if the page that initiated it is unloaded before the request is complete.

This enables a fetch() request to, for example, send analytics at the end of a session even if the user navigates away from or closes the page. This has some advantages over using Navigator.sendBeacon() for the same purpose, including allowing you to use HTTP methods other than POST, customize request properties, and access the server response via the fetch Promise fulfillment. It is also available in service workers.

Value

A boolean value indicating the keepalive status of the request.

Examples

Create a Request with keepalive

In the following snippet, we create a new request using the Request() constructor with keepalive set to true, then save the keepalive value of the request in a variable:

js
const options = {
  keepalive: true,
};

const myRequest = new Request("flowers.jpg", options);
let myKeepAlive = myRequest.keepalive; // true

Specifications

Specification
Fetch
# ref-for-dom-request-keepalive②

Browser compatibility

See also

  • ServiceWorker API
  • HTTP access control (CORS)
  • HTTP

Help improve MDN

Learn how to contribute

This page was last modified on Mar 13, 2025 by MDN contributors.

View this page on GitHub • Report a problem with this content
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.