spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column63


WMLScript Standard Libraries

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

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.

SyntaxgetVar(variable)
Parametersvariable = String
ReturnsString 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.

SyntaxsetVar(variable, value)
Parametersvariable = String, value = String
ReturnsBoolean 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.

Syntaxgo(url)
Parametersurl = String
ReturnsString 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.

Syntaxprev()
Parametersnone
ReturnsString 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.

SyntaxnewContext()
Parametersnone
ReturnsString 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.

SyntaxgetCurrentCard()
Parametersnone
ReturnsString 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.

SyntaxgetCurrentCard()
Parametersnone
ReturnsString or invalid
Examples:var a = WMLBrowser.setVar("years", 8); // a = ""
var b = WMLBrowser.refresh(); // b = ""

Next: How to use Dialogs library

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business


Created: June 5, 2000
Revised: June 5, 2000

URL: http://www.webreference.com/js/column63/9.html