Browser Web APIs Quick Reference

Search browser global APIs — fetch, Storage, IndexedDB, Workers, Canvas and more

Searchable quick reference of browser Web APIs grouped by category — networking, storage, DOM, observers, workers, media, and device. Each entry summarises what the global does, its key entry point, and a usage note. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is the difference between localStorage and IndexedDB?

localStorage is a simple synchronous key-value store limited to about 5 MB of strings, ideal for small flags and preferences. IndexedDB is an asynchronous transactional database that stores large structured data and binary blobs, suited to offline apps and caches. Use localStorage for tiny values and IndexedDB for real data.

The browser exposes hundreds of global APIs and remembering which object is the entry point for a given task is half the battle. This quick reference groups the Web APIs you reach for most — networking, storage, DOM, observers, workers, media, and device — with the global name, its purpose, and a usage note.

How it works

Each entry names a browser global (a constructor like IntersectionObserver, a namespace like navigator.geolocation, or a function like fetch) and places it in a category:

  • Networkingfetch, WebSocket, EventSource, XMLHttpRequest.
  • StoragelocalStorage, sessionStorage, indexedDB, caches, Cookie Store.
  • DOM & eventsdocument, CustomEvent, MutationObserver.
  • ObserversIntersectionObserver, ResizeObserver, PerformanceObserver.
  • WorkersWorker, SharedWorker, ServiceWorker.
  • Media & graphics — Canvas, WebGL, Web Audio, getUserMedia.
  • Device & misc — Geolocation, Clipboard, Notifications, Web Crypto.

Choosing the right API for common tasks

HTTP requests

Prefer fetch for all new code. It returns a Promise, supports async/await, accepts AbortController for cancellation, and has a clean Request/Response model with streaming support. Use XMLHttpRequest only for legacy code or when you specifically need upload progress events (the Fetch API’s ReadableStream can track download progress but XHR’s upload.onprogress is still easier for upload tracking).

Client-side data persistence

  • Small flags and preferences (under a few KB of strings): localStorage
  • Per-tab session state that should clear on close: sessionStorage
  • Structured data, offline caches, binary blobs, large datasets: indexedDB
  • Offline asset caching for PWAs: caches (Cache Storage, used via Service Worker)

The localStorage 5 MB limit bites more often than developers expect. If you are storing JSON arrays that grow over time, switch to IndexedDB before you hit it.

Observing DOM changes without scroll listeners

Scroll and resize event listeners run on every event, which causes layout thrashing if they read layout properties. The Observer APIs batch and defer notifications:

TaskAPI to use
Lazy-load images when in viewIntersectionObserver
Respond to element size changesResizeObserver
Watch DOM tree for additions/removalsMutationObserver
Measure rendering performancePerformanceObserver

Off-main-thread processing

A Worker runs JavaScript on a background thread and communicates via postMessage. Use it for anything CPU-heavy — parsing large JSON, image manipulation, WebAssembly execution — so the UI does not freeze. SharedWorker lets multiple tabs or windows share one worker instance, useful for coordinating state across tabs. ServiceWorker is a network proxy layer for PWA caching and offline support.

The secure-context requirement

Many APIs only work on HTTPS or localhost. Attempting to use them on plain HTTP silently fails or throws. APIs that require a secure context include:

  • navigator.geolocation
  • navigator.clipboard (Clipboard API)
  • crypto.subtle (Web Crypto)
  • navigator.mediaDevices.getUserMedia
  • ServiceWorkerRegistration
  • Notification.requestPermission

During local development, localhost counts as a secure context, so these APIs work there. On any HTTP deployment they will not.

Prefer asynchronous, non-blocking patterns

The main thread controls rendering. Any synchronous, long-running operation on the main thread will freeze the page. Prefer:

  • fetch (async) over XMLHttpRequest with synchronous mode
  • IntersectionObserver over scroll event listeners with getBoundingClientRect
  • ResizeObserver over window resize listeners
  • A Worker for any computation that would take more than a few milliseconds