Object: History
Availability
|
BlackBerry®
Device Software version 4.2 or later
|
The History object belongs to the Window object. It stores an array of the URLs that the user visited during the current browser session.
History properties
Property name
|
Type
|
Description
|
Status
|
Availability
|
current
|
String
|
Returns the complete URL of the current history entry.
|
read only
|
4.6 or later
|
length
|
int
|
Returns the number of URLs in the history list.
|
read only
|
4.6 or later
|
History methods
Method name
|
Description
|
Availability
|
back()
|
Displays the previous URL in the BlackBerry® Browser History list.
|
4.6 or later
|
forward()
|
Displays the next element in the BlackBerry Browser History list.
|
4.6 or later
|
go()
|
Causes the to display the URL that is the specified number of URLs before or after the current item in the BlackBerry Browser
History list.
|
4.6 or later
|
Method: history.back()
Availability
|
BlackBerry®
Device Software version 3.8 or later
|
The back() method displays the previous URL in the BlackBerry® Browser
History list. This method is functionally equivalent to the user clicking Back in the BlackBerry Browser
menu or clicking the Escape key during a browser session, or specifying History.go(-1).
Examples
The following code fragment adds a custom button to an HTML page that displays the previous item in the History list:
<INPUT TYPE="button" VALUE="Back" onClick="window.history.back()">
Method: history.forward()
Availability
|
BlackBerry®
Device Software version 3.8 or later
|
The forward() method displays the next element in the BlackBerry® Browser
History list. This method is functionally equivalent to the user clicking Forward in the BlackBerry Browser
menu, or specifying History.go(1).
Examples
The following code fragment adds a custom button to an HTML page that displays the next item in the History list:
<INPUT TYPE="button" VALUE="Forward" onClick="window.history.forward()">
Method: history.go()
Availability
|
BlackBerry®
Device Software version 3.8 or later
|
The go() method causes theBlackBerry® Browser
to display the given URL, or the URL at the given index location in the URL that is the specified number of URLs before or after the current item in the BlackBerry Browser
History list.
Syntax
history.go( targetURLposition )
Parameters
Parameter
|
Type
|
Description
|
targetURLposition
|
int
|
The position of the URL to display, relative to the current URL in the History list. A positive value moves forward in the history list; a negative value moves backward.
|
Examples
The following code fragment adds a custom button that causes the browser to display the URL three positions earlier than the current URL in the History list:
<INPUT TYPE="button" VALUE="Leap back three pages!" onClick="window.history.go(-3)">
Was this information helpful? Send us your comments.