WindowClient Class

A window client of a service worker (https://w3c.github.io/ServiceWorker/#windowclient-interface).

public sealed class WindowClient : Client
Inheritance
Client WindowClient

Properties

NameDescription
AncestorOriginsGets the ancestor origins of the document of the client.
FocusedGets whether the document of the client has the focus.
VisibilityStateGets the visibility state of the document of the client (visible or hidden).

AncestorOrigins

Clients.cs

Gets the ancestor origins of the document of the client.

public IReadOnlyList<string> AncestorOrigins { get; }

Focused

Clients.cs

Gets whether the document of the client has the focus.

public bool Focused { get; }

VisibilityState

Clients.cs

Gets the visibility state of the document of the client (visible or hidden).

public string VisibilityState { get; }

Methods

NameDescription
Focus()Focuses the window of the client (https://w3c.github.io/ServiceWorker/#client-focus).
Navigate(string)Navigates the window of the client to url (https://w3c.github.io/ServiceWorker/#client-navigate): returns its window client, or null when the new document does not have the origin of the service worker.

Focus()

Clients.cs

Focuses the window of the client (https://w3c.github.io/ServiceWorker/#client-focus).

public Task<WindowClient> Focus()

Returns

Task<WindowClient>

Remarks

A window of the origin must have the transient activation (e.g. the user clicked it).

See also