public interface Location
Location
object, which contains information about the URL of the document and provides methods for changing that URL. You can also assign to this property to load another URL.Modifier and Type | Method and Description |
---|---|
void |
assign(String url)
Load the document at the provided URL.
|
Indexable |
getAncestorOrigins() |
String |
getHash()
the part of the URL that follows the # symbol, including the # symbol.
You can listen for the hashchange event to get notified of changes to the hash in supporting browsers. |
String |
getHost()
the host name and port number.
|
String |
getHostname()
the host name (without the port number or square brackets).
|
String |
getHref()
the entire URL.
|
String |
getOrigin() |
String |
getPathname()
the path (relative to the host).
|
String |
getPort()
the port number of the URL.
|
String |
getProtocol()
the protocol of the URL.
|
String |
getSearch()
the part of the URL that follows the ? symbol, including the ? symbol.
|
void |
reload()
Reload the document from the current URL.
|
void |
replace(String url)
Replace the current document with the one at the provided URL.
|
void |
setHash(String arg) |
void |
setHost(String arg) |
void |
setHostname(String arg) |
void |
setHref(String arg) |
void |
setPathname(String arg) |
void |
setPort(String arg) |
void |
setProtocol(String arg) |
void |
setSearch(String arg) |
Indexable getAncestorOrigins()
String getHash()
void setHash(String arg)
String getHost()
void setHost(String arg)
String getHostname()
void setHostname(String arg)
String getHref()
void setHref(String arg)
String getOrigin()
String getPathname()
void setPathname(String arg)
String getPort()
void setPort(String arg)
String getProtocol()
void setProtocol(String arg)
String getSearch()
void setSearch(String arg)
void assign(String url)
void reload()
forceget
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.void replace(String url)
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.Copyright © 2018. All rights reserved.