All Tech Tips

location Object

Contains information about the current URL.

Members Table

PropertyDescription
hash Sets or retrieves the subsection of the href property that follows the number sign (#).
host Sets or retrieves the hostname and port number of the location or URL.
hostname Sets or retrieves the host name part of the location or URL.
href Sets or retrieves the entire URL as a string.
pathname Sets or retrieves the file name or path specified by the object.
port Sets or retrieves the port number associated with a URL.
protocol Sets or retrieves the protocol portion of a URL.
search Sets or retrieves the substring of the href property that follows the question mark.
MethodDescription
assign Loads a new HTML document.
reload Reloads the current page.
replace Replaces the current document by loading another document at the specified URL.

Remarks

The href property contains the entire URL, while the other properties contain portions of the URL. The default property for the location object is location.href. For example, setting location='http://microsoft.com' is equivalent to setting location.href='http://microsoft.com'.

The browser immediately navigates to the specified URL when any of the properties listed below are set.

This object is available in script as of Microsoft Internet Explorer 3.0.

Standards Information

There is no public standard that applies to this object.

Applies To

document, window


Copyright © 2006 alltechtips.com. All rights reserved.

This website and the materials and information you find on this website are provided "as is", without warranty of any kind, either express or implied, including without limitation any warranty for information, services, or products provided through or in connection with the service and any implied warranties of merchantability, fitness for a particular purpose, expectation of privacy or non-infringement.
Advertising
health | home | ip address | golf courses | recipes | flooring | rubber flooring | cd duplication | schools