All Objects
History
OBJECT: Location
The
Location
object is part of a
Window
object and is accessed through the
window.location
property. It contains the complete URL of a given
Window
object, or, if none is specified, of the current
Window
object. All of its properties are strings representing different portions of the URL, which generally takes the following form:
<protocol>//<host>[:<port>]/<pathname>[<hash>][<search>]
You can create a
Location
object by simply assigning a URL to the
location
property of an object:
Code:
window.location = "file:///C:/Projects"
PROPERTIES
hash
Property
The
hash
property is a string beginning with a hash (#), that specifies an anchor name in an HTTP URL.
Syntax:
location.
hash
host
Property
The
host
property is a string comprising of the
hostname
and
port
strings.
Syntax:
location.
host
hostname
Property
The
hostname
property specifies the server name, subdomain and domain name (or IP address) of a URL.
Syntax:
location.
hostname
href
Property
The
href
property is a string specifying the entire URL, and of which all other
Link
properties are substrings.
Syntax:
location.
href
pathname
Property
The
pathname
property is a string portion of a URL specifying how a particular resource can be accessed.
Syntax:
location.
pathname
port
Property
The
port
property is a string specifying the communications port that the server uses.
Syntax:
location.
port
protocol
Property
The
protocol
property is the string at the beginning of a URL, up to and including the first colon (:), which specifies the method of access to the URL.
Syntax:
location.
protocol
search
Property
The
search
property is a string beginning with a question mark that specifies any query information in an HTTP URL.
Syntax:
location.
search
METHODS
reload
Method
The
reload
method forces a reload of the window's current document, i.e. the one contained in the
Location.href
property.
Syntax:
location.
reload
([forceGet])
replace
Method
The
replace
method replaces the current
History
entry with the specified URL. After calling the
replace
method, you cannot navigate back to the previous URL using the browser's Back button.
Syntax:
location.
replace
(URL)
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information