JavaScript: The Definitive Guide

Previous Chapter 21
JavaScript Reference
Next
 

URL Object

Name

URL Object---a Universal Resource Locator

Availability

Navigator 2.0, Internet Explorer 3.0

Synopsis

window.location
document.links[i]

Properties

hash

A read/write string that specifies the hash portion of the URL, including the leading hash (#) mark. This portion specifies the name of an anchor within the object referred to by the URL.

host

A read/write string that specifies the combination of the hostname and port portions of the URL.

hostname

A read/write string that specifies the hostname portion of the URL.

href

A read/write string that specifies the complete URL.

pathname

A read/write string that specifies the path portion of the URL.

port

A read/write string that specifies the port portion of the URL.

protocol

A read/write string that specifies the protocol portion of the URL, including the trailing colon.

search

A read/write string that specifies the search or query portion of the URL, including the leading question mark.

Description

The URL object represents a URL--the location of an object on the Web. The various properties of the URL object are strings that contain various portions of the URL, such as the protocol, the hostname, and the query string.

The Area, Link, and Location objects are kinds of URL objects--they contain all of the properties of the URL object, plus additional properties of their own. URL objects cannot be used on their own, but may be used through the Link and Area objects in the Document.links[] array and the Location object referred to by the Window.location property.

See Also

"Area", "Link", "Location"


Previous Home Next
untaint() Book Index URL.hash

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell
This HTML Help has been published using the chm2web software.