Location Class

https://html.spec.whatwg.org/multipage/nav-history-apis.html#the-location-interface. The fragment navigations are performed synchronously; the other navigations use BrowsingContextOptions.DocumentLoader and are ignored when there is none.

public sealed class Location

Remarks

The URLs given to href, assign() and replace() are resolved against the entry document (the document of the running script, or the relevant document outside a script). The scripting bindings check that the members other than the setter of Location.Href and Location.Replace are accessed by a same origin-domain realm.

See also

Properties

NameDescription
AncestorOriginshttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-ancestororigins: the ancestor origins list of the relevant document.
Hashhttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-hash
Hosthttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-host
Hostnamehttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-hostname
Hrefhttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-href
Originhttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-origin
Pathnamehttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-pathname
Porthttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-port
Protocolhttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-protocol
Searchhttps://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-search

AncestorOrigins

Location.cs

https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-ancestororigins: the ancestor origins list of the relevant document.

public DomStringList AncestorOrigins { get; }

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

public string Hash { get; set; }

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

public string Host { get; set; }

Hostname

Location.cs

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

public string Hostname { get; set; }

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

public string Href { get; set; }

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

public string Origin { get; }

Pathname

Location.cs

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

public string Pathname { get; set; }

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

public string Port { get; set; }

Protocol

Location.cs

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

public string Protocol { get; set; }

Methods

NameDescription
Assign(string)https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-assign
Reload()https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-reload
Replace(string)https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-location-replace
ToString()Returns a string that represents the current object.

Assign(string)

Location.cs

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

public void Assign(string url)

Reload()

Location.cs

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

public void Reload()

Replace(string)

Location.cs

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

public void Replace(string url)

ToString()

Location.cs

Returns a string that represents the current object.

public override string ToString()

Returns

string A string that represents the current object.