Language

CoreWebView2ServiceWorkerRegistration.ScopeUri Property

Definition

The scopeUri is a fully qualified URI, including the scheme, host and path, that specifies the range of URLs a service worker can control.

When registering a service worker, if no scope is specified, it defaults to the directory where the service worker script resides. For example, if the script is located at https://example.com/app/sw.js, the default scopeUri would be https://example.com/app/. However, if a scope is provided, it is defined relative to the application's base URI. For instance, if an application at https://example.com/ registers a service worker with a scope of /app/, the resulting scopeUri is https://example.com/app/.

Refer to the Host Name Canonicalization for details on how normalization is performed. The same process applies to the Scope when a service worker is registered from DOM API. The scopeUri property reflects this normalization, ensuring that the URI is standardized. For example, HTTPS://EXAMPLE.COM/app/ is canonicalized to https://example.com/app/; https://bücher.de/ is canonicalized to https://xn--bcher-kva.de/.

The scope property of the ServiceWorkerRegistration object in the DOM returns the relative URL based on the application's base URI, while this property always returns a fully qualified URI. For more information on DOM API, see the MDN documentation.

public string ScopeUri { get; }
member this.ScopeUri : string
Public ReadOnly Property ScopeUri As String

Property Value

Applies to