Device and user-interaction APIs
Learn Device and user-interaction APIs (Module 22 · Browser APIs and Storage, Angular) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Talking to the device Browsers expose powerful features through APIs, usually asking the user for permission first: • Clipboard API : copy text with navigator.clipboard.writeText() (e.g. a "Copy link" button). • Geolocation API : navigator.geolocation.getCurrentPosition() returns latitude and longitude after the user allows it. • Notifications API : show a system notification after the user grants permission. • File API : read files the user picked from an <input type="file"> without uploading them first. • Drag and Drop API : native drag events, including dropping files onto your page.