CallbackContext Class

The place where a callback of BrowsingContextOptions is raised: the first argument of every callback (e.g. BrowsingContextOptions.ConsoleMessage, BrowsingContextOptions.DocumentActivated). It is a snapshot taken when the callback is invoked: it does not change when the browsing context navigates later.

public sealed class CallbackContext

Remarks

The callbacks raised by a browsing context (its creation, its navigations, the fullscreen and pointer lock requests, the downloads) have a CallbackContext.BrowsingContext, and CallbackContext.Global is its active window (null when it has none). The callbacks raised by a global object (the console messages, the unhandled errors, the content security policy violations, the dialogs, the file picker, the clipboard permission) have a CallbackContext.Global: a window, a worker or a worklet. The CallbackContext.BrowsingContext of a worker, of a worklet, or of a window whose document has no browsing context, is null.

Properties

NameDescription
BrowsingContextGets the browsing context of the callback: the browsing context that raised it, or the browsing context of the window that raised it. It is null for a worker, a worklet, or a window whose document has no browsing context.
DocumentGets the document of CallbackContext.Window, or null when the callback has no window.
GlobalGets the global object of the callback: the window, the worker or the worklet that raised it, or the active window of the browsing context that raised it (null when it has none).
OptionsGets the options whose callback is invoked.
WindowGets the window of the callback (CallbackContext.Global when it is a window), or null (e.g. a worker or a worklet).

BrowsingContext

CallbackContext.cs

Gets the browsing context of the callback: the browsing context that raised it, or the browsing context of the window that raised it. It is null for a worker, a worklet, or a window whose document has no browsing context.

public BrowsingContext? BrowsingContext { get; }

Property value

BrowsingContext?

Gets the document of CallbackContext.Window, or null when the callback has no window.

public Document? Document { get; }

Property value

Document?

Gets the global object of the callback: the window, the worker or the worklet that raised it, or the active window of the browsing context that raised it (null when it has none).

public GlobalScope? Global { get; }

Property value

GlobalScope?

Gets the options whose callback is invoked.

public BrowsingContextOptions Options { get; }

Gets the window of the callback (CallbackContext.Global when it is a window), or null (e.g. a worker or a worklet).

public Window? Window { get; }

Property value

Window?