Object: Location
The Location object is a property of the Window object. This object accesses the URL of the web page being displayed in the BlackBerry® Browser.
A URL is composed of some or all of the following components:
protocol://hostname:port/path?query#fragment.
Location properties
Property name |
Type |
Description |
Status |
Availability |
|---|---|---|---|---|
hash |
String |
Specifies the anchor portion of the URL, including the leading hash mark, if one exists. |
writable |
4.6 or later |
host |
String |
Specifies the URL hostname and port. |
writable |
4.6 or later |
hostname |
String |
Specifies the hostname portion of the URL. |
writable |
4.6 or later |
href |
String |
Specifies the entire URL. |
writable |
4.6 or later |
pathname |
String |
Specifies the pathname portion of the URL. |
writable |
4.6 or later |
port |
String |
Specifies the port portion of the URL. |
read only |
4.6 or later |
protocol |
String |
Specifies the protocol portion of the URL. |
writable |
4.6 or later |
search |
String |
Specifies the URL query string portion of the URL, including the question mark. |
writable |
4.6 or later |
Location methods
Method: location.assign()
The assign() method loads a new document. Unlike location.replace(), when the given URL is loaded, the old URL is still available in the BlackBerry® Browser History list.
Method: location.replace()
The replace() method replaces the current web page with the web page at the given URL. This method differs from Location.assign() in that when the old URL is replaced, it is not saved in the History list. As a result, the user will have no way to navigate back to it.