Java Reference
In-Depth Information
This property (as well as most of the others in this section) is a read/write property, which
means that it can also be changed by assignment. If this is done, the page will be re-
loaded using the new property. For example, the following line will redirect the page to the
SitePoint home page:
window.location.href = "http://www.sitepoint.com/"
<< "http://www.sitepoint.com/"
The protocol property returns a string describing the protocol used (such as http , ht-
tps , pop2 , ftp etc.). Note that there is a colon ( : ) at the end:
window.location.protocol
<< "https:"
The host property returns a string describing the domain of the current URL and the port
number (this is often omitted if the default port 80 is used):
window.location.host
<< "learnable.com"
The hostname property returns a string describing the domain of the current URL:
window.location.host
<< "learnable.com"
The port property returns a string describing the port number. It will return an empty
string if the port is not explicitly stated in the URL:
window.location.port
<< ""
The pathname property returns a string of the path that follows the domain:
window.location.pathname:
<< "/topics/all/book"
The search property returns a string that starts with a "? " followed by the query string
parameters. It returns an empty string if there are no query string parameters:
Search WWH ::




Custom Search