Class BrowsingContext
- Namespace
- AngleSharp
- Assembly
- AngleSharp.dll
A simple and lightweight browsing context.
public sealed class BrowsingContext : EventTarget, IBrowsingContext, IEventTarget, IDisposable
- Inheritance
-
BrowsingContext
- Implements
- Inherited Members
- Extension Methods
Constructors
BrowsingContext(IConfiguration?)
Creates a new browsing context with the given configuration, or the default configuration, if no configuration is provided.
public BrowsingContext(IConfiguration? configuration = null)
Parameters
configuration
IConfigurationThe optional configuration.
Remarks
This constructor was only added due to PowerShell. See #844 for details.
Properties
Active
Gets or sets the currently active document.
public IDocument? Active { get; set; }
Property Value
Creator
Gets the document that created the current context, if any. The creator is the active document of the parent at the time of creation.
public IDocument? Creator { get; }
Property Value
Current
Gets the current window proxy.
public IWindow? Current { get; }
Property Value
OriginalServices
Gets the original services for the given browsing context.
public IEnumerable<object> OriginalServices { get; }
Property Value
Parent
Gets the parent of the current context, if any. If a parent is available, then the current context contains only embedded documents.
public IBrowsingContext? Parent { get; }
Property Value
Security
Gets the sandboxing flag of the context.
public Sandboxes Security { get; }
Property Value
SessionHistory
Gets the session history of the given browsing context, if any.
public IHistory? SessionHistory { get; }
Property Value
Methods
CreateChild(string?, Sandboxes)
Creates a new named browsing context as child of the given parent.
public IBrowsingContext CreateChild(string? name, Sandboxes security)
Parameters
Returns
FindChild(string)
Finds a named browsing context.
public IBrowsingContext? FindChild(string name)
Parameters
name
stringThe name of the browsing context.
Returns
- IBrowsingContext
The found instance, if any.
GetService<T>()
Gets an instance of the given service.
public T? GetService<T>() where T : class
Returns
- T
The instance of the service or null.
Type Parameters
T
The type of service to resolve.
GetServices<T>()
Gets all registered instances of the given service.
public IEnumerable<T> GetServices<T>() where T : class
Returns
- IEnumerable<T>
An enumerable with all service instances.
Type Parameters
T
The type of service to resolve.
New(IConfiguration?)
Creates a new browsing context with the given configuration, or the default configuration, if no configuration is provided.
public static IBrowsingContext New(IConfiguration? configuration = null)
Parameters
configuration
IConfigurationThe optional configuration.
Returns
- IBrowsingContext
The browsing context to use.
NewFrom<TService>(TService)
Creates a new browsing context from the given service.
public static IBrowsingContext NewFrom<TService>(TService instance)
Parameters
instance
TServiceThe service instance.
Returns
- IBrowsingContext
The browsing context to use.
Type Parameters
TService