15.2. Clearing Variables and URL History: newContext() Function

The newContext() function is used to clear all variables and the URL history stored in the WML browser. The newContext() function does not take any parameters. Its syntax is like this:


WMLBrowser.newContext();


If the function call succeeds, newContext() returns an empty string, otherwise it returns an invalid value.

Below are some WMLScript examples that can help you understand the usage of the newContext() function better. Let's say you call the following script from a WML card:


extern function example_func1()
{
  WMLBrowser.newContext();
  WMLBrowser.prev();
}


In the above script, the call to prev() will not have any effect since the URL history stack has been cleared.

Note that any calls to the prev() function before calling newContext() will also have no effect. For example:


extern function example_func2()
{
  WMLBrowser.prev();
  WMLBrowser.newContext();
}


This is because the clearing of the URL history is done before the WML browser takes back control from the WMLScript interpreter, whereas the "going backward" task is done after the WML browser takes back control from the WMLScript interpreter.


Previous Page Page 32 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.