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 CallbackContextRemarks
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
| Name | Description |
|---|---|
| BrowsingContext | 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. |
| Document | Gets the document of CallbackContext.Window, or null when the callback has no window. |
| Global | 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). |
| Options | Gets the options whose callback is invoked. |
| Window | Gets the window of the callback (CallbackContext.Global when it is a window), or null (e.g. a worker or a worklet). |
BrowsingContext
CallbackContext.csGets 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
Document
CallbackContext.csGets the document of CallbackContext.Window, or null when the callback has no window.
public Document? Document { get; }Property value
Global
CallbackContext.csGets 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
Options
CallbackContext.csGets the options whose callback is invoked.
public BrowsingContextOptions Options { get; }Property value
Window
CallbackContext.csGets 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; }