as localStorage is a browser feature only available to javascript, webapi has no access.
to set and read a value, create an html webpage. add the javascript. sample:
<html>
<script>
const dosave = () => localStorage.setItem('value', document.getElementById("value").value);
const doret = () => alert(localStorage.getItem('value'));
</script>
<body>
value to store: <input id="value" type="text"><br>
<button type="button" onclick="dosave()">save</button>
<button type="button" onclick="doret()">retrieve</button>
</body>
</html>