public interface Location
Modifier and Type | Method and Description |
---|---|
void |
assign(java.lang.String url)
The assign() method loads a new document.
The difference between this method and replace(), is that replace() removes the URL of the current document from the document history, meaning that it is not possible to use the "back" button to navigate back to the original document. |
java.lang.String |
getHash()
The hash property returns the anchor part of a URL, including the hash sign (#).
|
java.lang.String |
getHost()
The host property returns the hostname and port of a URL.
|
java.lang.String |
getHostname()
The hostname property sets the hostname of a URL.
|
java.lang.String |
getHref()
The href property returns the entire URL of the current page.
|
java.lang.String |
getPathname()
The pathname property returns the pathname of a URL.
|
java.lang.String |
getPort()
The port property returns the port number the server uses for a URL.
Note: If the port number is not specified in the URL (or if it is the scheme's default port - like 80, or 443), some browsers will display 0 or nothing. |
java.lang.String |
getProtocol()
The protocol property returns the protocol of the current URL, including the colon (:).
|
java.lang.String |
getSearch()
The search property returns the querystring part of a URL, including the question mark (?).
|
void |
reload()
The reload() method is used to reload the current document.
The reload() method does the same as the reload button in your browser. By default, the reload() method reloads the page from the cache, but you can force it to reload the page from the server by setting the forceGet parameter to true: location.reload(true). |
void |
reload(boolean forceGet)
The reload() method is used to reload the current document.
The reload() method does the same as the reload button in your browser. By default, the reload() method reloads the page from the cache, but you can force it to reload the page from the server by setting the forceGet parameter to true: location.reload(true). |
void |
replace(java.lang.String url)
The replace() method replaces the current document with a new one.
The difference between this method and assign(), is that replace() removes the URL of the current document from the document history, meaning that it is not possible to use the "back" button to navigate back to the original document. Tip: Use the assign() method if you want to load a new document, and the option to navigate back to the original document. |
void |
setHash(java.lang.String anchorname)
The hash property sets the anchor part of a URL, including the hash sign (#).
|
void |
setHost(java.lang.String host)
The host property sets the hostname and port of a URL.
|
void |
setHostname(java.lang.String hostname)
The hostname property sets the hostname of a URL.
|
void |
setHref(java.lang.String href)
The href property sets the entire URL of the current page.
|
void |
setPathname(java.lang.String pathname)
The pathname property sets the pathname of a URL.
|
void |
setPort(java.lang.String port)
The port property sets the port number the server uses for a URL.
|
void |
setProtocol(java.lang.String protocol)
The protocol property sets the protocol of the current URL, including the colon (:).
|
void |
setSearch(java.lang.String search)
The search property sets the querystring part of a URL, including the question mark (?).
|
java.lang.String getHash()
void setHash(java.lang.String anchorname)
anchorname
- Specifies the anchor part of a URLjava.lang.String getHost()
void setHost(java.lang.String host)
host
- Specifies the hostname and port number of the URLjava.lang.String getHostname()
void setHostname(java.lang.String hostname)
hostname
- Specifies the hostname of the URLjava.lang.String getHref()
void setHref(java.lang.String href)
href
- Specifies the URL of the link.java.lang.String getPathname()
void setPathname(java.lang.String pathname)
pathname
- Specifies the pathname of the URLjava.lang.String getPort()
void setPort(java.lang.String port)
port
- Specifies the port number of the URLjava.lang.String getProtocol()
void setProtocol(java.lang.String protocol)
protocol
- The protocol of the URL. Possible values:
java.lang.String getSearch()
void setSearch(java.lang.String search)
search
- Specifies the search part of the URLvoid assign(java.lang.String url)
url
- Required. Specifies the URL of the page to navigate tovoid reload()
void reload(boolean forceGet)
forceGet
- Optional. Specifies the type of reloading:void replace(java.lang.String url)
url
- Required. Specifies the URL of the page to navigate to