Origin Class

An origin (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-interface), for the same origin and same site comparisons.

public sealed class Origin

Constructors

NameDescription
Origin()Creates a new opaque origin (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-constructor).

Origin()

Origin.cs

Creates a new opaque origin (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-constructor).

public Origin()

Properties

NameDescription
OpaqueGets whether the origin is opaque (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-opaque).

Opaque

Origin.cs

Gets whether the origin is opaque (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-opaque).

public bool Opaque { get; }

Methods

NameDescription
From(object?)Returns the origin of a value (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-from): the origin of a platform object that has one (Origin, a same origin-domain Window, a WorkerGlobalScope, a MessageEvent fired by the user agent, Url, the HTML, SVG and MathML a elements and the area element with a URL), or the origin of a URL string.
IsSameOrigin(Origin)Returns whether the origin is same origin with another one (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-issameorigin).
IsSameSite(Origin)Returns whether the origin is same site with another one (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-issamesite).
ToString()Returns a string that represents the current object.

From(object?)

Origin.cs

Returns the origin of a value (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-from): the origin of a platform object that has one (Origin, a same origin-domain Window, a WorkerGlobalScope, a MessageEvent fired by the user agent, Url, the HTML, SVG and MathML a elements and the area element with a URL), or the origin of a URL string.

public static Origin From(object? value)

Parameters

value object?
The value.

Returns

Origin A new Origin object.

Exceptions

TypeErrorException
The value has no origin.

See also

IsSameOrigin(Origin)

Origin.cs

Returns whether the origin is same origin with another one (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-issameorigin).

public bool IsSameOrigin(Origin other)

IsSameSite(Origin)

Origin.cs

Returns whether the origin is same site with another one (https://html.spec.whatwg.org/multipage/browsers.html#dom-origin-issamesite).

public bool IsSameSite(Origin other)

ToString()

Origin.cs

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.