QuickDevGuide

Home › HTML

HTML5 APIs & Data Attributes — HTML

HTML5 introduced powerful JavaScript APIs accessible from HTML. Geolocation API Allows users to share their physical location. The browser always asks for explicit permission. getCurrentPosition() is a one-time location request; watchPosition() tracks movement (for navigation apps). Web Storage API Before HTML5, only cookies existed (tiny, sent with every request). Web Storage stores much larger amounts locally. localStorage persists even after browser close. sessionStorage clears when the tab closes. Drag and Drop API Makes any element draggable with draggable="true". Involves events: dragstart, dragover, and drop. Custom Data Attributes data- attributes store extra information directly in HTML elements — a bridge between HTML and JavaScript without clashing with standard attributes…

Key Takeaways