WMLScript » WMLBrowser » WMLBrowser.newContext

Syntax:
WMLBrowser.newContext()

Clears the WML browser context.

The WMLBrowser.newContext function clears out the current WML browser context. This entails emptying the navigation stack history and clearing out all variables. Upon completion, the empty string "" is returned.

Note that any pending navigation requests from either a WMLBrowser.go or WMLBrowser.prev function call will not be effected.

In WML, the card tag has a newcontext attribute that performs a similar purpose.

This function does not take a parameter.

Examples

Code:
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.WAPforum.org/DTD/wml_1.1.xml">
<wml>

<card id="card1">
   <p>
   newContext example
   </p>
   <do type="accept">
      <go href="NewContextExample.wmls#findnewcontext()" />
   </do>
</card>

<card id="card2">
<p>
   Should return the empty string
   <br />
   new context = $(newcontext)
</p>
</card>

</wml>
Explanation:

Code for NewContextExample.wml

Language(s): WML
Code:
extern function findnewcontext()
{
   var newcon = WMLBrowser.newContext();
   WMLBrowser.setVar("newcontext", newcon);
   WMLBrowser.go("NewContextExample.wml#card2");
};
Explanation:

Code for NewContextExample.wmls

Language(s): WML

See Also: