History Class

https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-history-interface. The session history is the joint session history of the top-level traversable (its entries and the ones of its child navigables). The documents of the other entries are not kept alive (there is no back/forward cache): a traversal to another document loads it again.

public sealed class History

Remarks

Each document has its own History object (https://html.spec.whatwg.org/multipage/nav-history-apis.html#doc-history): a navigation that reuses the window of an initial about:blank document gives it a new History object.

The state is structured-serialized by History.PushState and History.ReplaceState (by the script engine of the window, or, without a script engine, only the primitive values and the serializable platform objects can be serialized), and History.State is a deserialization of the state of the session history entry.

See also

Properties

NameDescription
Lengthhttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-length
ScrollRestorationhttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-scroll-restoration
Statehttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-state

https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-length

public uint Length { get; }

ScrollRestoration

History.cs

https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-scroll-restoration

public ScrollRestoration ScrollRestoration { get; set; }

https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-state

public object? State { get; }

Methods

NameDescription
Back()https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-back
Forward()https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-forward
Go(int)https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-go
PushState(object?, string, string?)https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-pushstate
ReplaceState(object?, string, string?)https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-replacestate

https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-back

public void Back()

Forward()

History.cs

https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-forward

public void Forward()

Go(int)

History.cs

https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-go

public void Go(int delta = 0)

PushState(object?, string, string?)

History.cs

https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-pushstate

public void PushState(object? data, string unused, string? url = null)

ReplaceState(object?, string, string?)

History.cs

https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-history-replacestate

public void ReplaceState(object? data, string unused, string? url = null)