A developer is building a multi-page form wizard. They need to persist data across form steps without exposing it in the URL. What is the recommended storage mechanism for this temporary, session-scoped data?
- A.sessionStorage: it scopes data to the current browser tab and session - cleared when the tab closes, not shared between tabs. This is ideal for multi-step form wizards where data is temporary, user-specific, and should not leak between browser sessions or tabs
- B.localStorage: it keeps data on the device across tabs and restarts, and the wizard can read the earlier steps from any tab of the same site, with the browser deleting entries after an expiry date that the developer sets in the setItem call and the user can review in the cookie settings page
- C.A hidden form field: the server echoes the earlier answers back in the HTML of each step, and the browser carries them to the next request, keeping the data out of the URL and off the disk of the device
- D.A signed cookie: the server sets the wizard answers in a cookie on each response, and the browser returns it with each request, keeping the data out of the URL while the tab is open on the site