BlazorWebView.StaticContentCacheControlProvider Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a callback that determines the Cache-Control header value used for static content
(such as images, fonts, or stylesheets) served from the app's content root.
By default no callback is set and all served content uses no-cache, max-age=0, must-revalidate,
no-store, which disables WebView caching. Provide a callback to opt specific resources into caching,
which can avoid repeated file reads and reduce image reload flicker when navigating between pages.
Return null or an empty string from the callback to keep the default behavior for a
given request. Cache entries remain subject to platform limits, expiration, and eviction.
The callback is invoked from the platform's request handling, which may run on a background thread, so it must not access UI state directly. If the callback throws, the exception is logged and the request falls back to the default header.
public:
property Func<Microsoft::AspNetCore::Components::WebView::Maui::BlazorWebViewStaticContentRequest ^, System::String ^> ^ StaticContentCacheControlProvider { Func<Microsoft::AspNetCore::Components::WebView::Maui::BlazorWebViewStaticContentRequest ^, System::String ^> ^ get(); void set(Func<Microsoft::AspNetCore::Components::WebView::Maui::BlazorWebViewStaticContentRequest ^, System::String ^> ^ value); };
public Func<Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewStaticContentRequest,string?>? StaticContentCacheControlProvider { get; set; }
member this.StaticContentCacheControlProvider : Func<Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewStaticContentRequest, string> with get, set
Public Property StaticContentCacheControlProvider As Func(Of BlazorWebViewStaticContentRequest, String)