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


A button for going back to the top of this page