Browser Web APIs Reference

Essential browser APIs: Fetch, WebSocket, Service Workers, Web Storage, Geolocation, Canvas, WebGL, Notifications, Clipboard.

The data

Apis

NameCategoryPurposeBasic usageBrowser supportRelated apis
Fetch APInetworkingModern promise-based interface for making HTTP requests, replacing XMLHttpRequest.fetch(url).then(res => res.json()).then(data => console.log(data));All modern browsers (IE not supported)
  • XMLHttpRequest
  • Request
  • Response
  • Headers
WebSocketnetworkingFull-duplex, persistent TCP connection for real-time bidirectional communication.const ws = new WebSocket('wss://example.com'); ws.onmessage = e => console.log(e.data);All modern browsers
  • WebSocketServer (Node.js)
  • Server-Sent Events
Service WorkersofflineBackground scripts that act as network proxies, enabling offline support, caching, and push notifications.navigator.serviceWorker.register('/sw.js').then(reg => console.log('Registered'));All modern browsers (IE no)
  • Cache API
  • Push API
  • Background Sync
  • Notification
Web Storage (localStorage/sessionStorage)storageSimple key-value storage for small amounts of data, persisted across sessions (localStorage) or tab lifetime (sessionStorage).localStorage.setItem('key', 'value'); const v = localStorage.getItem('key');All browsers including IE8+
  • IndexedDB
  • Cache API
  • Cookies
IndexedDBstorageLow-level transactional database for storing large amounts of structured data (including files/blobs).const db = await indexedDB.open('mydb', 1); db.onsuccess = e => { const store = e.target.result... }All modern browsers
  • Web Storage
  • Cache API
  • File API
Geolocation APIhardwareRetrieve device's geographic location (latitude, longitude) with user permission.navigator.geolocation.getCurrentPosition(pos => console.log(pos.coords.latitude, pos.coords.longitude));All modern browsers (HTTPS required)
  • Geolocation API (W3C)
  • DeviceOrientation API
Canvas APIgraphics2D drawing surface for rendering shapes, text, images, and animations via JavaScript.const ctx = canvas.getContext('2d'); ctx.fillRect(10, 10, 100, 100);All modern browsers (IE9+)
  • WebGL
  • CanvasRenderingContext2D
  • OffscreenCanvas
WebGLgraphicsJavaScript API for rendering 3D and 2D graphics using the GPU via OpenGL ES.const gl = canvas.getContext('webgl2'); gl.clearColor(0, 0, 0, 1); gl.clear(gl.COLOR_BUFFER_BIT);All modern browsers (IE11 has WebGL 1)
  • WebGL2
  • WebGPU (next-gen)
  • Three.js (library)
Notifications APInotificationsDisplay system notifications to the user, even when the browser is not in focus.Notification.requestPermission().then(p => { if (p === 'granted') new Notification('Hello!'); });All modern browsers (requires permission)
  • Push API
  • Service Workers
Clipboard APIutilitiesRead from and write to the system clipboard (text, images, rich content) with user permission.await navigator.clipboard.writeText('Copied!'); const text = await navigator.clipboard.readText();All modern browsers (HTTPS required)
  • ExecCommand (legacy)
  • ClipboardEvent
History APInavigationManipulate browser session history (pushState, replaceState) for single-page app navigation without reloads.history.pushState({page: 2}, 'Title 2', '/page2'); window.onpopstate = e => console.log(e.state);All modern browsers (IE10+)
  • Location
  • Window.location
Intersection ObserverobserverAsynchronously observe changes in intersection of target element with ancestor or viewport.const observer = new IntersectionObserver(entries => { entries.forEach(e => console.log(e.isIntersecting)); }); observer.observe(el);All modern browsers (IE not)
  • ResizeObserver
  • MutationObserver

Fetch the same bytes

The static files are identical to what the API returns, but with no rate limit and no server round trip. Use the API when you want a query and a content type; use the files when you want to cache one document.

curl "https://yjtoon.com/api/dataset/browser-web-apis-reference?format=toon"
const res = await fetch(
  "https://yjtoon.com/static-data/dataset/browser-web-apis-reference.toon"
);
const toon = await res.text();

Rate limit: 120 requests per minute per IP, no key and no signup. API reference →

Topics

  • javascript
  • browser
  • api
  • websocket
  • fetch
  • service-worker
  • webgl