Me gustaría guardar datos o valores como con html y usarlos nuevamente cuando la página se abra nuevamente. Tengo aquí un ejemplo de https://www.w3schools.com/html/html5_webstorage.asp cómo funciona en html, ¿todo funciona también en blazor?
function clickCounter() { if (typeof(Storage) !== "undefined") { if (localStorage.clickcount) { localStorage.clickcount = Number(localStorage.clickcount)+1; } else { localStorage.clickcount = 1; } document.getElementById("result").innerHTML = "You have clicked the button " + localStorage.clickcount + " time(s)."; } else { document.getElementById("result").innerHTML = "Sorry, your browser does not support web storage..."; } } <!DOCTYPE html> <html> <head> </head> <body> <p><button onclick="clickCounter()" type="button">Click me!</button></p> <div id="result"></div> <p>Click the button to see the counter increase.</p> <p>Close the browser tab (or window), and try again, and the counter will continue to count (is not reset).</p> </body> </html>En realidad, Blazor solo puede acceder al almacenamiento local del navegador a través de JavaScript; WASM no tiene acceso directo.
Sin embargo, es mucho más fácil si usa una biblioteca como https://github.com/Blazored/LocalStorage ; esto proporcionará el JS necesario y se puede inyectar como un servicio.