You can use an access control pragma to protect a file's content. You must call the access control pragma before calling external functions. Using more than one access control pragma in a file generates a compiler error.
Every time your code calls an external function, the compiler performs an access control check to determine if the destination file allows access from the caller. The access control pragma specifies domain and path attributes against which the compiler performs its access control checks. If a file has a domain or path attribute, the referring file's URL must match the values of the attributes. The compiler performs matching as follows:
The access domain is suffix-matched against the domain-name portion of the referring URL.
The access path is prefix-matched against the path-name portion of the referring URL.
Domain and path attributes follow URL capitalization rules.
The compiler performs domain suffix matching using the entire element of each sub-domain, and must match each element exactly. For example, www.wapforum.org matches wapforum.org but not forum.org.
The compiler performs path prefix matching using entire path elements and must match each element exactly. For example, /X/Y matches /X, but not /XZ.
The domain attribute defaults to the current file's domain. The path attribute defaults to the value " / ".
To simplify the development of applications that may not know the absolute path to the current file, the path attribute accepts relative URLs. The user agent converts the relative path to an absolute path and then performs prefix matching against the path attribute. For example, if the access-control attributes for a file are
use access domain "wapforum.org" path "/finance";
the following referring URLs would be allowed to call the external functions specified in this file:
http://wapforum.org/finance/money.cgi
https://www.wapforum.org/finance/markets.cgi
http://www.wapforum.org/finance/demos/packages.cgi?x+123&y+456
However, the following URLs would not be allowed to call the external function:
http://www.test.net/finance
http://www.wapforum.org/internal/foo.wml
By default, access control is disabled.