SyntaxStudy
Sign Up
HTML Beginner 3 min read

HTML APIs Summary

HTML APIs Summary

Modern browsers provide rich APIs: Geolocation, Drag-and-Drop, Web Storage, Canvas, Fetch, History, Intersection Observer, Web Workers, Notifications, Clipboard, File, Broadcast Channel, ResizeObserver, MutationObserver.

Example
// Quick reference
navigator.geolocation.getCurrentPosition(cb);  // Location
localStorage / sessionStorage                  // Storage
fetch(url, options).then(r => r.json())       // HTTP
history.pushState(state, title, url)          // URL
new IntersectionObserver(cb).observe(el)      // Viewport
new Worker("worker.js")                       // Background thread
new Notification("Title", { body })           // System notify
navigator.clipboard.writeText(text)           // Clipboard
new FileReader().readAsDataURL(file)          // File read
new BroadcastChannel("name")                  // Tab comms
Pro Tip

Check caniuse.com before using newer APIs in production — browser support varies.