Skip to content

Detect whether the current render mode is interactive before accessing browser storage #35905

@guardrex

Description

@guardrex

Description

Add content and an example for ...

It's good that we show that you can handle access storage in OnAfterRenderAsync. You could also detect whether the current render mode is interactive or not before accessing browser storage. I think that should work even in OnInitializedAsync.

Cross-ref: #35873 (comment)

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/state-management/protected-browser-storage?view=aspnetcore-9.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/state-management/protected-browser-storage.md

Document ID

8e81e30e-a6ea-209f-3039-7b900da642f0

Platform Id

123408a5-b68c-1c59-f314-24fd7682efd4

Article author

@guardrex

Metadata

  • ID: 8e81e30e-a6ea-209f-3039-7b900da642f0
  • PlatformId: 123408a5-b68c-1c59-f314-24fd7682efd4
  • Service: aspnet-core
  • Sub-service: blazor

Related Issues

Metadata

Metadata

Assignees

Type

No type

Projects

Status

P0/P1 - High Priority

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions