Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

The locationobject contains information about the current URL.

Properties

Property Data type Access Description

hash

String

Read/write

Sets or retrieves the part of URL starting from the pound sign (#) inclusive and beyond. If you change the hash, the browser scrolls up or down to the appropriate bookmark but the hash property does not reflect the change.

host

String

Read/write

Sets or retrieves the hostname of the page location.

In Internet Explorer Mobile, this property does not return the port number.

hostname

String

Read/write

Sets or retrieves the host name part of the page location.

href

String

Read/write

Sets or retrieves the entire URL as a string.

pathname

String

Read/write

Sets or retrieves the file name or path of the page location.

port

String

Read/write

Sets or retrieves the port number associated with the URL.

search

String

Read/write

Sets or retrieves the search (query) string portion of the URL. This includes the leading question mark.

Methods

Method Syntax Description

reload

location .reload

Reloads the current page.

This method does not take the ReloadSourceparameter, which specifies whether to check reload the page from the browser's cache or to reload it from the server. Internet Explorer Mobile always checks against the server if the user is online.

replace

location .replace( URL )

Replaces the current document by loading the document at the specified URL (in the required URLparameter).

Requirements

Windows Mobile Pocket PC 2000 and later, Smartphone 2002 and later

See Also