iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

HTML Web APIs

"Web API" is the umbrella term for the JavaScript interfaces browsers expose for talking to the page, the user, and the device — without third-party plugins.

Useful Web APIs

APILets you…
DOMRead and change the document tree.
FetchMake HTTP requests.
GeolocationRead the user's latitude and longitude (with permission).
Web StorageSave key/value data in localStorage or sessionStorage.
IndexedDBStore larger, queryable data on the device.
Web WorkersRun JavaScript on a background thread.
Service WorkersIntercept network requests — enables offline and Progressive Web Apps.
WebSocketTwo-way real-time connection.
Server-Sent EventsServer-pushed updates over HTTP.
Canvas / WebGL / WebGPU2D and 3D graphics.
Web AudioGenerate and process sound.
NotificationsShow system notifications.
ClipboardRead and write the clipboard (with permission).
Drag and DropMake any element draggable / droppable.
Tip: Many APIs require a secure context (HTTPS) and explicit user permission. Always handle the "denied" case gracefully — never block the user just because they said no to a prompt.

Example

Example
<!DOCTYPE html>
<html>
<head>
    <title>HTML Web APIs</title>
</head>
<body>

<h1>HTML Web APIs</h1>
<p>This is a demo page for the "HTML Web APIs" lesson.</p>

</body>
</html>
Try it Yourself »

Exercise

Name the Web API method used to make HTTP requests in modern JavaScript.

const res = await ('/api/users');

Test yourself

Q1. Web APIs are exposed by…
Q2. Use feature detection over UA sniffing because…
Q3. Service Workers power…

Discussion

Loading…