15. WMLScript WMLBrowser Standard Library

WMLScript's WMLBrowser standard library contains seven functions in total. They are used to control the WML browser or to get information from it.


15.1. Going Forwards / Backwards to WML Cards: go() and prev() Functions

The go() function and the prev() function of the WMLBrowser standard library are used to go forwards and backwards to WML cards respectively. The syntax of go() is as follows:


WMLBrowser.go(url);


url is the URL of the WML card to go to. For example:


WMLBrowser.go("wmlscript_tutorial.wml");


The prev() function does not take any parameters. Its syntax is like this:


WMLBrowser.prev();


Both go() and prev() return an empty string if everything works fine. They return an invalid value if errors occur.

Note that the WML browser will load the target card only when it takes back control from the WMLScript interpreter.

Suppose a script calls go() or prev() multiple times before the WML browser takes back control. When the WML browser resumes control, it will only load the card specified by the last call. For example, let's say you call the following script from a WML card:


extern function example_func1()
{
  WMLBrowser.go("wml_tutorial.wml");
  WMLBrowser.go("wmlscript_tutorial.wml");
}


When the WML browser receives control, it will load the WML document wmlscript_tutorial.wml specified in the last statement.

Here is another example:


extern function example_func2()
{
  WMLBrowser.go("wml_tutorial.wml");
  WMLBrowser.go("wmlscript_tutorial.wml");
  WMLBrowser.prev();
}


When the WML browser receives control, it will go to the previous card.

If the script to be called is like this:


extern function example_func3()
{
  WMLBrowser.prev();
  WMLBrowser.prev();
}


The WML browser will go backward once, but not twice, when it takes back control from the WMLScript interpreter.


Previous Page Page 31 of 71 Next Page


Feedback Form (ExpandCollapse)

What do you think about this web page?






(Optional) Please provide us more details. For example, suppose you select option 2 above, can you tell us specifically what information is missing? You can also suggest anything that can help us improve this web page.

(Optional) Your name:

(Optional) Your email address:

Please enter again to confirm:

Due to the amount of messages we received, we may not be able to reply to all messages.

A button for going back to the top of this page