Chapter 14. WMLScript Pragmas

This chapter discusses the features of WMLScript known as pragmas , which specify meta-information about a WMLScript unit, in a similar way to the <meta> and <access> elements for WML files. (See Chapter 6, for more information on these WML elements.)

You have already encountered one pragma, the url pragma for referencing other WMLScript units, in Chapter 13. In addition, there is an access pragma, corresponding to WML’s <access> element, and a meta pragma, corresponding to the <meta> element. These pragmas are processed by the WAP gateway (see Appendix B) to control the headers sent along with the compiled unit.

All pragmas in a WMLScript file must be specified before any functions. The individual pragmas may be specified in any order, however.

The access Pragma

The access pragma provides the same simple access control as the <access> element does for WML decks. That is, it specifies a domain and path that must match the URL of the caller for a call to be permitted.

There are three forms:

use access domain domain;
use access path path;
use access domain domain path path;

Both domain and path are normal WMLScript string literals. They are interpreted in exactly the same way as the domain and path attributes of WML’s <access> element. (See Chapter 6 for more information.) There may be no more than one access pragma per WMLScript file.

For example, the pragma:

use access domain "wap.net" path "/private";

restricts access to WML and WMLScript that originates ...

Get Learning WML, and WMLScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.