Table of Contents

Interface IHistory

Namespace
AngleSharp.Browser.Dom
Assembly
AngleSharp.dll

The History interface allows to manipulate the browser session history, that is the pages visited in the tab or frame that the current page is loaded in.

[DomName("History")]
public interface IHistory
Extension Methods

Properties

Index

Gets the index within the session history.

int Index { get; }

Property Value

int

this[int]

Gets the document at the given position of the history.

IDocument this[int index] { get; }

Parameters

index int

The position within the history.

Property Value

IDocument

The document related to that position.

Length

Gets the number of elements in the session history, including the currently loaded page.

[DomName("length")]
int Length { get; }

Property Value

int

State

Gets an any value representing the state at the top of the history stack.

[DomName("state")]
object State { get; }

Property Value

object

Methods

Back()

Goes to the previous page in session history, the same action as when the user clicks the browser's Back button. Equivalent to history.go(-1).

[DomName("back")]
void Back()

Forward()

Goes to the next page in session history, the same action as when the user clicks the browser's Forward button; this is equivalent to history.go(1).

[DomName("forward")]
void Forward()

Go(int)

Loads a page from the session history, identified by its relative location to the current page, for example -1 for the previous page or 1 for the next page. When integerDelta is out of bounds (e.g. -1 when there are no previously visited pages in the session history), the method doesn't do anything and doesn't raise an exception. Calling go() without parameters or with a non-integer argument has no effect.

[DomName("go")]
void Go(int delta = 0)

Parameters

delta int

The number of states to surpass.

PushState(object, string?, string?)

Pushes the given data onto the session history stack with the specified title and, if provided, URL. The data is treated as opaque by the DOM.

[DomName("pushState")]
void PushState(object data, string? title, string? url = null)

Parameters

data object

The data to use.

title string

The title to take.

url string

The URL to consider.

ReplaceState(object, string?, string?)

Updates the most recent entry on the history stack to have the specified data, title, and, if provided, URL. The data is treated as opaque by the DOM.

[DomName("replaceState")]
void ReplaceState(object data, string? title, string? url = null)

Parameters

data object

The data to use.

title string

The title to take.

url string

The URL to consider.