Browsers now ship useful primitives that used to require a library or a custom polling loop. They are not universally interchangeable with a framework feature, and support requirements still matter. These ten are worth checking when a page needs to cancel work, observe layout, coordinate tabs, or present data clearly. Test on the browsers your audience actually uses and keep an accessible fallback where needed.

1. AbortController

A search box can cancel an old fetch when the user types a new query, avoiding stale results overwriting fresh ones. Pass an AbortSignal to supported APIs and handle the abort as an expected outcome rather than a customer error. Cancellation stops client-side waiting; it does not guarantee the server rolled back work already started. Source: MDN AbortController.

2. IntersectionObserver

Lazy-load a long list or mark a table-of-contents section active when it enters the viewport. The observer avoids hand-written scroll handlers that repeatedly measure layout. It reports intersection, not whether a human actually read the content, so avoid using it as a reliable analytics event on its own. Source: MDN IntersectionObserver.

3. ResizeObserver

A card or chart may need to respond to the size of its container rather than the whole window. ResizeObserver reports element-size changes, which helps in resizable dashboards and embedded components. Avoid writing styles in a way that immediately changes the observed size again; that feedback loop produces unstable layouts. Source: MDN ResizeObserver.

4. BroadcastChannel

Two tabs of the same origin can tell each other that the user logged out or changed a draft. The channel is a convenient message bus, not durable storage: a tab opened later misses earlier messages. Read canonical state from the server or local storage on startup, and treat messages as prompts to refresh it. Source: MDN BroadcastChannel.

5. Web Locks

If several tabs might sync the same offline data, a named lock can ensure only one tab performs the task at a time. It coordinates work for the same origin, not across your servers or users. Keep the critical section short, handle a tab closing unexpectedly, and verify browser support before making the lock essential to correctness. Source: MDN Web Locks API.

6. Page Visibility API

Pause an expensive animation or reduce polling while a tab is hidden. Resume by checking current state rather than replaying every missed tick. Visibility is a hint for efficiency, not a trustworthy signal that the user has left; browsers may throttle background work independently of your code. Source: MDN Page Visibility API.

7. URLSearchParams

Filters become easier to share when their state lives in the URL. URLSearchParams handles encoding and repeated keys more safely than concatenating strings by hand. Decide whether an empty parameter means “all,” “none,” or “not specified,” and test back/forward navigation so a restored URL matches the controls on screen. Source: MDN URLSearchParams.

8. Intl formatters

Dates, numbers, currencies, and relative time should follow the reader’s locale. Intl.DateTimeFormat and Intl.NumberFormat handle many regional conventions that custom string templates get wrong. Keep the underlying timestamp and numeric value separate from its display text; a formatted string is a presentation, not a database value. Source: MDN Intl.DateTimeFormat; MDN Intl.NumberFormat.

9. The dialog element

A modal needs focus handling, keyboard dismissal, and a way to keep background controls out of the interaction. The native dialog element with showModal covers much of that behavior. You still need a clear label, sensible focus destination, and tests with assistive technology; the element does not write accessible content for you. Source: MDN dialog element.

10. sendBeacon

A small analytics or diagnostic payload can be sent while the page is unloading without blocking navigation. Beacon delivery is asynchronous and not a guaranteed transaction log. For a payment, save operation, or other critical action, use an ordinary request with an acknowledged server response instead of relying on unload timing. Source: MDN Navigator.sendBeacon.

How to use this list

The best browser primitive is the one that removes code while preserving a clear failure path. Check compatibility, make the product usable without the enhancement when appropriate, and measure whether it really improves the page. Native APIs are building blocks, not automatic solutions.

Sources and scope

Each entry links to primary documentation or project guidance. Check current versions and browser compatibility before applying a technique to a production system.

More on Software Engineering →