JavaScript PushManager supportedContentEncodings Property

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline 2025
Static property

What You’ll Learn

PushManager.supportedContentEncodings is a read-only static property on PushManager that returns a frozen array of content codings for encrypting push payloads—usually "aes128gcm". Learn why your app server needs it, how to send it with a PushSubscription, the TypeError when modifying the array, and MDN’s server-post pattern—with five examples and try-it labs.

01

Kind

Static property

02

Returns

string[]

03

Typical

aes128gcm

04

Frozen

no modify

05

Context

Secure + workers

06

Status

Baseline Jan 2025

Introduction

Web push messages are encrypted end-to-end between your application server and the browser. The browser generates keys; only the public key and auth secret are shared with your server via PushSubscription.

The server also needs to know which encryption coding to use. PushManager.supportedContentEncodings answers that question—it lists codings this user agent supports, such as aes128gcm from RFC 8291.

💡
Static property reminder

Read it on the PushManager class, not on registration.pushManager: PushManager.supportedContentEncodings.

Understanding supportedContentEncodings

A read-only static data property on PushManager returning supported push payload encodings.

  • Type — array of strings.
  • StaticPushManager.supportedContentEncodings, not on instances.
  • Frozen — MDN: the array may not be modified; writes throw TypeError.
  • Required coding — user agents must support aes128gcm.
  • Server use — pick a supported coding when encrypting; set Content-Encoding on push HTTP requests.
  • Secure context — Push API features require HTTPS (or localhost).
  • Workers — available in Web Workers per MDN.
  • Baseline 2025 — newly available since January 2025.

📝 Syntax

JavaScript
PushManager.supportedContentEncodings

Return value

An array of strings. MDN: this usually contains just one value: "aes128gcm".

Exceptions

TypeError — thrown when attempting to set a value in the returned (frozen) array.

⚡ Quick Reference

GoalCode / note
Read encodingsPushManager.supportedContentEncodings
Check aes128gcmPushManager.supportedContentEncodings.includes("aes128gcm")
Send to serverInclude in JSON with endpoint + keys
Feature detecttypeof PushManager !== "undefined"
Do not mutateFrozen array — TypeError on write
MDN statusBaseline 2025 (since January 2025)

🔍 At a Glance

Four facts to remember about supportedContentEncodings.

Access
static

On PushManager

Value
string[]

Frozen array

Coding
aes128gcm

RFC 8291

Baseline
Jan 2025

Newly available

Examples Gallery

Examples follow MDN supportedContentEncodings. Use View Output or Try It Yourself.

📚 Getting Started

Read the static property and inspect values.

Example 1 — Read PushManager.supportedContentEncodings

Log the supported codings array from the PushManager class.

JavaScript
if (typeof PushManager !== "undefined") {
  console.log(PushManager.supportedContentEncodings);
  // Usually: ["aes128gcm"]
} else {
  console.log("PushManager not available");
}
Try It Yourself

How It Works

Access the property on PushManager, not on a subscription instance.

Example 2 — Verify aes128gcm Support

MDN requires user agents to support this RFC 8291 coding.

JavaScript
const encodings = PushManager.supportedContentEncodings;
const supportsAes = encodings.includes("aes128gcm");

console.log(supportsAes); // true
Try It Yourself

How It Works

Your server should encrypt using a coding from this list.

📈 Server Handoff & Safety

Frozen array rules and MDN subscription post.

Example 3 — Frozen Array (TypeError on Modify)

MDN: the returned array may not be modified.

JavaScript
const encodings = PushManager.supportedContentEncodings;

try {
  encodings[0] = "custom";
} catch (err) {
  console.log(err.name); // "TypeError"
}
Try It Yourself

How It Works

Treat the array as read-only; copy values if you need your own list.

Example 4 — MDN: Send Encoding to App Server

Include encoding with endpoint and keys after subscribe().

JavaScript
const pushSubscription =
  await serviceWorkerRegistration.pushManager.subscribe();

const subscriptionObject = {
  endpoint: pushSubscription.endpoint,
  keys: {
    p256dh: pushSubscription.getKey("p256dh"),
    auth: pushSubscription.getKey("auth"),
  },
  encoding: PushManager.supportedContentEncodings,
};

fetch("https://example.com/push/", {
  method: "POST",
  body: JSON.stringify(subscriptionObject),
});
Try It Yourself

How It Works

MDN does not mandate a transport—POST JSON is one common approach.

Example 5 — Feature Detect in Secure Context

Guard before reading the static property on older browsers.

JavaScript
function getSupportedEncodings() {
  if (!window.isSecureContext) {
    return null;
  }
  if (typeof PushManager === "undefined") {
    return null;
  }
  if (!PushManager.supportedContentEncodings) {
    return null;
  }
  return PushManager.supportedContentEncodings;
}

console.log(getSupportedEncodings());
Try It Yourself

How It Works

Baseline 2025 is new—feature-detect on engines without this static property.

🚀 Common Use Cases

  • Tell your application server which Content-Encoding to use when encrypting pushes.
  • Include encodings in the JSON body posted after pushManager.subscribe().
  • Validate server-side encryption libraries against client-supported codings.
  • Document push setup for beginners learning the full subscribe → encrypt → deliver flow.
  • Pair with getKey() and endpoint for complete server configuration.

🔧 How It Works

1

User subscribes

Browser creates PushSubscription with keys and endpoint.

Subscribe
2

Read encodings

PushManager.supportedContentEncodings lists supported codings.

Static
3

Send to server

Post endpoint, keys, and encoding array to your backend.

Config
4

Server encrypts

App server encrypts with chosen coding; browser decrypts before PushEvent.data.

📝 Notes

  • Baseline 2025 (MDN: newly available since January 2025).
  • Not Deprecated, Experimental, or Non-standard — no status banner required.
  • Static property — use PushManager.supportedContentEncodings only.
  • Frozen array — do not push or assign; copy if you need a mutable list.
  • Secure context — HTTPS or localhost for Push API.
  • Related learning: PushEvent.data, PushEvent(), navigator.serviceWorker, JavaScript hub.

Browser Support

PushManager.supportedContentEncodings is Baseline Newly available on MDN (since January 2025). Feature-detect on older engines. Logos use the shared browser-image-sprite.png sprite from this project.

Baseline 2025

PushManager.supportedContentEncodings

Static frozen array of push payload content encodings.

Baseline Newly available 2025
Google Chrome Supported in current releases — feature-detect older
Yes
Microsoft Edge Supported in current releases — feature-detect older
Yes
Mozilla Firefox Supported in current releases — feature-detect older
Yes
Apple Safari Supported in current releases — feature-detect older
Yes
Opera Follow Chromium support
Yes
Internet Explorer Not supported — no Push API
No
supportedContentEncodings Baseline

Bottom line: Feature-detect typeof PushManager and supportedContentEncodings. Send the array to your app server with subscription keys.

Conclusion

PushManager.supportedContentEncodings is a static, read-only, frozen array telling your application server which content codings it may use to encrypt push payloads—typically aes128gcm. Send it with PushSubscription endpoint and keys, and never mutate the returned array.

Continue with PushEvent.data, navigator.serviceWorker, PushEvent(), or the JavaScript hub.

💡 Best Practices

✅ Do

  • Read PushManager.supportedContentEncodings on the class
  • Send encodings to your server with subscription details
  • Feature-detect on browsers before January 2025
  • Use aes128gcm when it appears in the list
  • Copy the array if you need a mutable local list

❌ Don’t

  • Mutate the frozen returned array
  • Read it from registration.pushManager instances
  • Assume every browser exposes PushManager in non-secure contexts
  • Skip encoding info when configuring your push backend
  • Hard-code only legacy encodings without checking the array

Key Takeaways

Knowledge Unlocked

Five things to remember about supportedContentEncodings

Static push encryption codings for your server.

5
Core concepts
📦02

string[]

frozen

Type
🔐03

aes128gcm

RFC 8291

Coding
🚀04

server

encrypt push

Use
🎯05

Baseline

since Jan 2025

Status

❓ Frequently Asked Questions

A read-only frozen array of strings naming content encodings the user agent supports for encrypting push message payloads—usually ["aes128gcm"].
No. MDN marks it as Baseline 2025 (newly available since January 2025). It is not Deprecated, Experimental, or Non-standard.
Static. Read it on PushManager itself: PushManager.supportedContentEncodings—not on registration.pushManager.
The server must encrypt push payloads using a coding the browser supports. It also sets the Content-Encoding HTTP header on each push message.
No. MDN says the array is frozen. Attempting to set a value throws TypeError.
MDN: user agents must support the aes128gcm content coding defined in RFC 8291.
Did you know?

MDN’s example posts encoding: PushManager.supportedContentEncodings alongside endpoint and keys—the spec does not define how to transport that data, so teams often use JSON.stringify and fetch.

Check push subscription

Learn getSubscription()—see if the user already subscribed.

getSubscription() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful