WMLScript Standard Libraries: The WMLBrowser Library
WMLScript Standard Libraries
The WMLBrowser Library
This library contains functions that WMLScript can use to access the associated WML context. These functions must not have side effects and they must return invalid if the system does not support WML Browser or if the WMLScript interpreter is not invoked by the browser.
getVar()
This function returns the value of the given variable in the current browser context. Returns an empty string if the variable is not found. invalid
is returned if the variable name is invalid.
Syntax | getVar(variable) |
Parameters | variable = String |
Returns | String or invalid |
Examples: | var a = WMLBrowser.getVar("years"); // a = 7 |
setVar()
This function sets the value of the given variable in the current browser context. Returns true
if successful, false
otherwise. invalid
is returned if the variable name is invalid.
Syntax | setVar(variable, value) |
Parameters | variable = String, value = String |
Returns | Boolean or invalid |
Examples: | var a = WMLBrowser.setVar("years", 8); // a = true |
go()
This function loads the content from the specified URL. The content is loaded only after control is assumed by the WML browser. No content is loaded if the given URL is empty. The go()
and prev()
functions override each other. Only the settings of the last call stay in effect. This function returns an empty string.
Syntax | go(url) |
Parameters | url = String |
Returns | String or invalid |
Examples: | var a = WMLBrowser.go(card); // a = true |
prev()
This function signals the WML browser to go back to the previous WML card. The content is loaded only after control is assumed by the WML browser. The go()
and prev()
functions override each other. Only the settings of the last call stay in effect. This function returns an empty string.
Syntax | prev() |
Parameters | none |
Returns | String or invalid |
Examples: | var a = WMLBrowser.prev(); // a = "" |
newContext()
This function clears all variables of the associated WML context as well as the navigation history stack, except for the current card. The function does not impact any pending navigation requests from previous go()
and/or prev()
calls. It returns an empty string.
Syntax | newContext() |
Parameters | none |
Returns | String or invalid |
Examples: | var a = WMLBrowser.newContext(); // a = "" |
getCurrentCard()
This function returns the smallest relative URL of the current card, relative to the base of the current compilation unit. Returns an absolute URL if the WML deck containing the current card does not have the same base as the current compilation unit.
Syntax | getCurrentCard() |
Parameters | none |
Returns | String or invalid |
Examples: | var a = WMLBrowser.getCurrentCard(); // a = "card2#myData" |
refresh()
This function signals to the WML browser to update its user interface based on the current context. Returns invalid
if the system does not support immediate refresh. Returns an empty string if the refresh succeeds, or a non-empty string if it fails. In case of failure, the function should return a brief message.
Syntax | getCurrentCard() |
Parameters | none |
Returns | String or invalid |
Examples: | var a = WMLBrowser.setVar("years", 8); // a = "" |
Next: How to use Dialogs library
Produced by Yehuda Shiran and Tomer Shiran
Created: June 5, 2000
Revised: June 5, 2000
URL: https://www.webreference.com/js/column63/9.html