HTML5 Web Storage and APIs Flashcards
6 cards from real HTML5 practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 HTML5 Web Storage and APIs flashcards as text
Which HTML5 Web Storage object stores data with no expiration date, persisting even after the browser is closed?
Answer: localStorage
localStorage stores key-value pairs with no expiration, persisting across browser sessions until explicitly cleared.
What is the difference between localStorage and sessionStorage?
Answer: localStorage persists until cleared; sessionStorage clears when the tab closes
sessionStorage data is cleared when the browser tab or window is closed, while localStorage data persists indefinitely until explicitly removed.
Which method is used to store a value in localStorage?
Answer: localStorage.setItem(key, value)
The setItem(key, value) method stores a key-value pair in the localStorage object.
What does the Geolocation API's getCurrentPosition() method do?
Answer: Retrieves the device's current geographic coordinates asynchronously
getCurrentPosition() asynchronously requests the device's current position and passes the coordinates to a success callback.
Which HTML5 API enables communication between a web page and a server without page reload?
Answer: All of the above
XMLHttpRequest, the Fetch API, WebSocket, and Server-Sent Events all allow web pages to communicate with servers without a full page reload.
What is the purpose of the HTML5 History API?
Answer: Allows manipulation of the browser session history without page reloads
The History API lets developers push states to and manipulate the browser's session history, enabling SPA navigation without full page loads.