Properties

.hash. String with the anchor name. EG: Returns #book.

.host. String with the host name & port number. EG: Returns fake.com:80.

.hostname. String with the domain name or IP address. EG: Returns fake.com.

.href. String with the whole URL. Set this property to change the URL shown. EG: Returns http://www.fake.com:80/a/test.htm?a=1&b=2#book.

.pathname. String with the path portion of the URL. EG: Returns /a/test.htm. EG: location.pathname.substring(location.pathname.lastIndexOf('/')+1) returns test.htm. EG: location.pathname.substring(0,location.pathname.lastIndexOf('/')+1) returns /a/.

.port. String with the port number. EG: Returns 80.

.protocol. String with the protocol including the protocol but not the slashes. EG: Returns http:.

.search. String with the info passed to a GET CGI-BIN call. EG: Returns ?a=1&b=2.

Methods

.reload(). Reloads the document.

.replace(URL). Writes the URL over the previous URL in the history list, making it impossible to use the Back button to the previous URL.



GeorgeHernandez.comSome rights reserved