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 |
Support level |
Availability |
|---|---|---|---|---|---|
|
hash |
DOMString |
Specifies the anchor portion of the URL, including the leading hash mark, if one exists. |
writable |
Not part of any standard. |
4.6 or later |
|
host |
DOMString |
Specifies the URL hostname and port. |
writable |
Not part of any standard. |
4.6 or later |
|
hostname |
DOMString |
Specifies the hostname portion of the URL. |
writable |
Not part of any standard. |
4.6 or later |
|
href |
DOMString |
Specifies the entire URL. |
writable |
Not part of any standard. |
4.6 or later |
|
pathname |
DOMString |
Specifies the pathname portion of the URL. |
writable |
Not part of any standard. |
4.6 or later |
|
port |
DOMString |
Specifies the port portion of the URL. |
read only |
Not part of any standard. |
4.6 or later |
|
protocol |
DOMString |
Specifies the protocol portion of the URL. |
writable |
Not part of any standard. |
4.6 or later |
|
search |
DOMString |
Specifies the URL query string portion of the URL, including the question mark. |
writable |
Not part of any standard. |
4.6 or later |
Location methods
|
Method name |
Description |
Support level |
Availability |
|---|---|---|---|
|
Loads a new document. |
Not part of any standard. |
4.6 or later |
|
|
Replaces the current web page with the web page at the given URL. |
Not part of any standard. |
4.6 or later |
|
|
Reloads the current web page. |
Not part of any standard. |
4.6 or later |
|
|
Returns the URL of the Location object’s URL. |
Not part of any standard. |
4.6 or later |
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.