Advance JavaScript (DOM, BOM, Web API) / Web API

Introduction to Web API

  • A Web API is a set of tools the browser gives you so JavaScript can interact with the web environment.

  • JavaScript by itself is small, but Web APIs add extra powers like making network requests, animations, timers, storage, etc.

  • They act like a bridge between your JS code and browser features.

  • Many Web APIs work asynchronously (like fetch(), geolocation, etc.).

  • They are essential for building modern, interactive web apps.


🚩Examples of Web APIs in the Browser

API

Purpose

DOM API

Manipulate HTML and CSS dynamically (document.getElementById, querySelector)

BOM API

Work with browser objects like window, history, location, navigator

Fetch API

Make HTTP requests to servers

Geolocation API

Get user’s location

Canvas API

Draw graphics and animations

Web Storage API

Store data in localStorage or sessionStorage

Audio/Video API

Control multimedia on the page

Notifications API

Show desktop notifications