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 |
- 1. WMLScript Introduction
- 2. Hello World WMLScript Example
- 3. Compiling WMLScript Code
- 4. WMLScript Language Rules
- 5. Defining WMLScript Functions
- 6. Calling WMLScript Functions
- 7. WMLScript Variables
- 8. WMLScript Data Types
- 9. WMLScript Variables Vs WML Variables
- 10. Passing Arguments to Functions By Value and By Reference
- 11. WMLScript Operators
- 12. WMLScript Conditional Statements
- 13. WMLScript Looping Statements
- 14. WMLScript Standard Libraries Overview
- 15. WMLScript WMLBrowser Standard Library
- 16. WMLScript Dialogs Standard Library
- 17. WMLScript String Standard Library
- 18. WMLScript Float Standard Library
- 19. WMLScript Lang Standard Library
- 20. WMLScript URL Standard Library
- 21. WMLScript Example: Validating Form Data