Location
package js.html
Available on js
The Location
interface represents the location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to. Both the Document
and Window
interface have such a linked Location
, accessible via Document.location
and Window.location
respectively.
Documentation Location by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Variables
hash:String
Is a DOMString
containing a '#'
followed by the fragment identifier of the URL.
host:String
Is a DOMString
containing the host, that is the hostname, a ':'
, and the port of the URL.
hostname:String
Is a DOMString
containing the domain of the URL.
href:String
Is a DOMString
containing the entire URL. If changed, the associated document navigates to the new page. It can be set from a different origin than the associated document.
read onlyorigin:String
Returns a DOMString
containing the canonical form of the origin of the specific location.
pathname:String
Is a DOMString
containing an initial '/'
followed by the path of the URL.
port:String
Is a DOMString
containing the port number of the URL.
protocol:String
Is a DOMString
containing the protocol scheme of the URL, including the final ':'
.
search:String
Is a DOMString
containing a '?'
followed by the parameters or "querystring" of the URL. Modern browsers provide URLSearchParams and URL.searchParams to make it easy to parse out the parameters from the querystring.
Methods
assign(url:String):Void
Loads the resource at the URL provided in parameter.
Throws:
null |
DOMError |
---|
reload(forceget:Bool = false):Void
Reloads the resource from the current URL. Its optional unique parameter is a Boolean
, which, when it is true
, causes the page to always be reloaded from the server. If it is false
or not specified, the browser may reload the page from its cache.
Throws:
null |
DOMError |
---|
replace(url:String):Void
Replaces the current resource with the one at the provided URL. The difference from the assign()
method is that after using replace()
the current page will not be saved in session History
, meaning the user won't be able to use the back button to navigate to it.
Throws:
null |
DOMError |
---|
© 2005–2020 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/Location.html