Browser APIs
Browser APIs are built-in interfaces provided by the browser that handles compelx operations and extend JavaScript with capabilities such as DOM manipulation, network requests, handling timers, storing data, accessing device features, and running background tasks. Some of the most commonly used Browser APIs are as follows:
- Network requests
- XMLHTTPRequest (XHR)
- Fetch
- Web workers
- Service workers
- Web storage
- DOM events
- setTimeout
- setInterval
- navigator.geolocation
- Promise
Key features and characteristics of Browser APIs
- These are provided by the browser, not by the JavaScript language.
- Provides capabilities to handle compex operation and extend JavaScript with more capabilities.
- Both synchronous (localStorage, sessionStorage etc.) and asynchronous (e.g., fetch, XMLHttpRequest, timers etc.).
- Some require user permission (e.g., Media Devices API, Geolocation, Notifications etc. ).
- Though most modern APIs are standardized, availability can vary slightly between browsers.