Table of Contents

Interface IWindow

Namespace
AngleSharp.Dom
Assembly
AngleSharp.dll

The interface for a browsing window element. https://developer.mozilla.org/en-US/docs/Web/API/Window

[DomName("Window")]
public interface IWindow : IEventTarget, IGlobalEventHandlers, IWindowEventHandlers, IWindowTimers, IDisposable
Inherited Members
Extension Methods

Properties

Document

Gets a reference to the document that the window contains.

[DomName("document")]
IDocument Document { get; }

Property Value

IDocument

History

Gets the history of the current window.

[DomName("history")]
IHistory? History { get; }

Property Value

IHistory

IsClosed

Gets if the window has been closed.

[DomName("closed")]
bool IsClosed { get; }

Property Value

bool

Location

Gets the location of the current document.

[DomName("location")]
[DomPutForwards("href")]
ILocation Location { get; }

Property Value

ILocation

Name

Gets or sets the name of the window.

[DomName("name")]
string? Name { get; set; }

Property Value

string

Navigator

Gets the user-agent information.

[DomName("navigator")]
INavigator? Navigator { get; }

Property Value

INavigator

OuterHeight

Gets the height of the outside of the browser window.

[DomName("outerHeight")]
int OuterHeight { get; }

Property Value

int

OuterWidth

Gets the width of the outside of the browser window.

[DomName("outerWidth")]
int OuterWidth { get; }

Property Value

int

Proxy

Gets the proxy to the current browsing context.

[DomName("window")]
[DomName("frames")]
[DomName("self")]
IWindow? Proxy { get; }

Property Value

IWindow

ScreenX

Gets the horizontal distance of the left border of the user's browser from the left side of the screen.

[DomName("screenX")]
int ScreenX { get; }

Property Value

int

ScreenY

Gets the vertical distance of the top border of the user's browser from the top side of the screen.

[DomName("screenY")]
int ScreenY { get; }

Property Value

int

Status

Gets or sets the status of the window.

[DomName("status")]
string? Status { get; set; }

Property Value

string

Methods

Alert(string)

Shows the messagebox with the given message.

[DomName("alert")]
void Alert(string message)

Parameters

message string

The message to display.

Blur()

Removes the focus from the current window.

[DomName("blur")]
void Blur()

Close()

Closes the window.

[DomName("close")]
void Close()

Confirm(string)

Opens a confirmation box with the provided message.

[DomName("confirm")]
bool Confirm(string message)

Parameters

message string

The message to display.

Returns

bool

True if the message has been confirmed, otherwise false.

Focus()

Focuses the current window.

[DomName("focus")]
void Focus()

Open(string, string?, string?, string?)

Opens a window to show url, and returns it. If a window exists with the provided name already, it is reused.

IWindow Open(string url = "about:blank", string? name = null, string? features = null, string? replace = null)

Parameters

url string

The URL to open initially.

name string

The name of the new window.

features string

Determines the rendering of the new window.

replace string

Can be used to remove whatever page is currently open from the session history.

Returns

IWindow

The new or reused window.

Print()

Opens the print dialog for the current window.

[DomName("print")]
void Print()

Stop()

Stops the current document from being loaded.

[DomName("stop")]
void Stop()